本文整理汇总了C#中Canguro.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Canguro.Run方法的具体用法?C# Canguro.Run怎么用?C# Canguro.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canguro
的用法示例。
在下文中一共展示了Canguro.Run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
/// <summary>
/// Executes the command.
/// Execute CopyCmd and PasteCmd until cancelled.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
services.Run(new CopyCmd());
PasteCmd cmd;
do
{
services.Run(cmd = new PasteCmd());
services.Model.ChangeModel();
}
while (cmd.ObjectCount > 0);
}
示例2: Run
/// <summary>
/// Executes the command.
/// Opens the Open File Dialog and Loads the selected tsm file.
/// Asks to save changes if needed.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
if (services.Model.Modified)
{
DialogResult dr = MessageBox.Show(Culture.Get("askSaveChangesAndExit"), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (dr == DialogResult.Cancel)
return;
else if (dr == DialogResult.Yes)
services.Run(new SaveModelCmd());
}
string path = "";
System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
dlg.Filter = "Treu Structure Model (*.tsm)|*.tsm";
dlg.DefaultExt = "tsm";
dlg.AddExtension = true;
dlg.Title = Culture.Get("OpenFileTitle");
if (services.Model.CurrentPath.Length > 0)
dlg.FileName = services.Model.CurrentPath;
dlg.CheckPathExists = true;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
path = dlg.FileName;
try
{
if (path.Length > 0)
{
services.Model.Load(path);
}
}
catch
{
MessageBox.Show(Culture.Get("errorLoadingFile") + " " + path, Culture.Get("error"),
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例3: Run
/// <summary>
/// Executes the command.
/// Asks to save changes if needed and Resets the current Model.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
try
{
if (services.Model.Modified)
{
DialogResult dr = MessageBox.Show(Culture.Get("askSaveChangesAndExit"), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (dr == DialogResult.Cancel)
return;
else if (dr == DialogResult.Yes)
services.Run(new SaveModelCmd());
}
services.Model.Reset();
}
catch (Exception)
{
MessageBox.Show("Error creating new file.");
}
}