本文整理汇总了C#中SIM.Instances.Instance类的典型用法代码示例。如果您正苦于以下问题:C# Instance类的具体用法?C# Instance怎么用?C# Instance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Instance类属于SIM.Instances命名空间,在下文中一共展示了Instance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
Assert.ArgumentNotNull(mainWindow, "mainWindow");
var instances = InstanceManager.PartiallyCachedInstances ?? InstanceManager.Instances;
Assert.IsNotNull(instances, "instances");
var otherInstances = instances.Where(x => x.ID != instance.ID);
foreach (var otherInstance in otherInstances)
{
if (otherInstance == null)
{
continue;
}
try
{
var processIds = otherInstance.ProcessIds;
foreach (var processId in processIds)
{
var process = Process.GetProcessById(processId);
Log.Info("Killing process " + processId, this);
process.Kill();
}
}
catch (Exception ex)
{
Log.Warn("An error occurred", this, ex);
}
}
}
示例2: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
Assert.ArgumentNotNull(mainWindow, "mainWindow");
var instances = InstanceManager.Instances;
Assert.IsNotNull(instances, "instances");
var otherInstances = instances.Where(x => x.ID != instance.ID);
foreach (var otherInstance in otherInstances)
{
try
{
if (otherInstance == null)
{
continue;
}
Log.Info("Recycling instance " + otherInstance, this);
otherInstance.Recycle();
}
catch (Exception ex)
{
Log.Warn("An error occurred", this, ex);
}
}
}
示例3: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
if (EnvironmentHelper.CheckSqlServer())
{
WindowHelper.ShowDialog(new DatabasesDialog(), mainWindow);
}
}
示例4: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
Analytics.TrackEvent("Refresh");
using (new ProfileSection("Refresh main window instances", this))
{
ProfileSection.Argument("mainWindow", mainWindow);
ProfileSection.Argument("instance", instance);
var refreshMode = this.GetMode(mainWindow);
switch (refreshMode)
{
case RefreshMode.Instances:
MainWindowHelper.RefreshInstances();
return;
case RefreshMode.Installer:
MainWindowHelper.RefreshInstaller();
return;
case RefreshMode.Caches:
MainWindowHelper.RefreshCaches();
return;
case RefreshMode.Everything:
MainWindowHelper.RefreshEverything();
return;
}
}
}
示例5: CopyAgentFiles
public static void CopyAgentFiles(Instance instance)
{
Assert.ArgumentNotNull(instance, "instance");
string agent = Path.Combine(instance.WebRootPath, AgentHelper.AgentPath);
FileSystem.FileSystem.Local.Directory.Ensure(agent);
var files = new[]
{
new
{
FileName = PublishAgentFiles.PublishFileName,
Contents = PublishAgentFiles.PublishContents
},
new
{
FileName = PublishAgentFiles.StatusFileName,
Contents = PublishAgentFiles.StatusContents
}
};
foreach (var file in files)
{
string targetFilePath = Path.Combine(agent, file.FileName);
FileSystem.FileSystem.Local.Directory.DeleteIfExists(targetFilePath);
FileSystem.FileSystem.Local.File.WriteAllText(targetFilePath, file.Contents);
}
}
示例6: DoUpdateLicense
private static void DoUpdateLicense(string licenseFilePath, Instance instance)
{
if (instance != null)
{
try
{
FileSystem.FileSystem.Local.File.Copy(licenseFilePath, instance.LicencePath, true);
}
catch (Exception ex)
{
Log.Error(ex.Message, typeof(LicenseUpdater), ex);
}
}
else
{
foreach (Instance inst in InstanceManager.Instances)
{
try
{
FileSystem.FileSystem.Local.File.Copy(licenseFilePath, inst.LicencePath, true);
}
catch (Exception ex)
{
Log.Error(ex.Message, typeof(LicenseUpdater), ex);
}
}
}
}
示例7: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
if (FileSystem.FileSystem.Local.Directory.Exists(ProfileManager.Profile.LocalRepository))
{
WizardPipelineManager.Start("download8", mainWindow, null, null, MainWindowHelper.RefreshInstaller, WindowsSettings.AppDownloaderSdnUserName.Value, WindowsSettings.AppDownloaderSdnPassword.Value);
}
}
示例8: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
Assert.ArgumentNotNull(mainWindow, "mainWindow");
if (instance == null)
{
Run(mainWindow, string.Empty);
return;
}
var ids = (instance.ProcessIds ?? new int[0]).ToArray();
if (ids.Length == 0)
{
WindowHelper.HandleError("No running w3wp processes for this Sitecore instance", false);
return;
}
foreach (var id in ids)
{
var defaultValue = id.ToString(CultureInfo.InvariantCulture);
if (Run(mainWindow, defaultValue))
{
return;
}
}
}
示例9: ClickDetailsWrapper
public ClickDetailsWrapper(MouseClickInformation clickDetails, Instance instance, EventArgs rawArgs)
{
this.ClickDetails = clickDetails;
this.Instance = instance;
this.RawArgs = rawArgs;
this.IsInstanceClick = instance != null;
}
示例10: GetIconForInstance
protected virtual Image GetIconForInstance(Instance instance)
{
string version = instance.Product.ShortVersion;
string instanceName = instance.Name;
if (this.InternalCache.ContainsKey(instanceName))
{
return this.InternalCache[instanceName];
}
Image resolvedImage = null;
if (!version.IsNullOrEmpty() && version.Length > 1)
{
var shortVersion = version.Substring(0, 2);
var resolvedIcon = MultisourceResourcesManager.GetIconResource("sc" + shortVersion, null);
if (resolvedIcon != null)
{
resolvedImage = resolvedIcon.ToBitmap();
}
}
if (resolvedImage == null && this.DefaultIcon != null)
{
resolvedImage = this.DefaultIcon.ToBitmap();
}
this.InternalCache.Add(instanceName, resolvedImage);
return resolvedImage;
}
示例11: ReinstallArgs
public ReinstallArgs(Instance instance, SqlConnectionStringBuilder connectionString, string license, string webServerIdentity, bool serverSideRedirect)
{
this.ConnectionString = connectionString;
this.Name = instance.Name;
this.Bindings = instance.Bindings;
this.Product = instance.Product;
this.WebRootPath = instance.WebRootPath;
this.RootPath = instance.RootPath;
this.DataFolderPath = instance.DataFolderPath;
this.DatabasesFolderPath = Path.Combine(this.RootPath, "Databases");
this.WebServerIdentity = webServerIdentity;
this.LicenseFilePath = license;
this.Modules = new Product[0];
this.IsClassic = instance.IsClassic;
this.Is32Bit = instance.Is32Bit;
this.ForceNetFramework4 = instance.IsNetFramework4;
this.ServerSideRedirect = serverSideRedirect;
this.TempFolder = Path.Combine(this.RootPath, "Temp");
this.InstanceDatabases = instance.AttachedDatabases;
this.instanceName = instance.Name;
this.StopInstance = instance.Stop;
this.WebsiteID = instance.ID;
var executionTimeout = UpdateWebConfigHelper.GetHttpRuntime(instance.GetWebResultConfig()).GetAttribute("executionTimeout");
this.IncreaseExecutionTimeout = string.IsNullOrEmpty(executionTimeout) || executionTimeout != "600";
}
示例12: ProcessInstanceClickInternal
protected override bool ProcessInstanceClickInternal(Instance instance)
{
if (OSShellHelper.ConfirmFileRun("Visual Studio project"))
{
return base.ProcessInstanceClickInternal(instance);
}
return true;
}
示例13: InstallModulesWizardArgs
public InstallModulesWizardArgs(Instance instance = null)
{
this.Instance = instance;
if (instance != null)
{
this.WebRootPath = instance.WebRootPath;
}
}
示例14: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
if (instance != null)
{
var id = MainWindowHelper.GetListItemID(instance.ID);
WizardPipelineManager.Start("installmodules", mainWindow, null, null, () => MainWindowHelper.MakeInstanceSelected(id), instance);
}
}
示例15: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
Assert.ArgumentNotNull(mainWindow, "mainWindow");
Assert.IsNotNull(instance, "instance");
InstanceHelperEx.OpenInBrowserAsAdmin(instance, mainWindow, this.VirtualPath, this.Browser, this.Params);
}