本文整理汇总了C#中XenAdmin.Actions.ActionBase类的典型用法代码示例。如果您正苦于以下问题:C# ActionBase类的具体用法?C# ActionBase怎么用?C# ActionBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionBase类属于XenAdmin.Actions命名空间,在下文中一共展示了ActionBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: action_Completed
void action_Completed(ActionBase sender)
{
ActivationRequestAction action = (ActivationRequestAction)sender;
if (action.Succeeded)
Program.OpenURL(string.Format(InvisibleMessages.ACTIVATION_FORM_URL, InvisibleMessages.ACTIVATION_SERVER, action.Result));
else
{
if (DialogResult.Cancel == ShowSaveDialog())
throw action.Exception;
SaveFileDialog fd = new SaveFileDialog();
Program.Invoke(Program.MainWindow,
delegate()
{
fd.AddExtension = true;
fd.DefaultExt = "txt";
fd.Filter = string.Format("{0} (*.*)|*.*", Messages.ALL_FILES);
fd.FilterIndex = 0;
fd.RestoreDirectory = true;
if (DialogResult.Cancel == fd.ShowDialog(Program.MainWindow))
throw action.Exception;
using (FileStream fs = File.Open(fd.FileName, FileMode.Create))
{
byte[] bytes = Encoding.UTF8.GetBytes(_request);
fs.Write(bytes, 0, bytes.Length);
}
});
//Description = string.Format(Messages.ACTIVATION_REQUEST_SAVED, fd.FileName);
}
}
示例2: CompareOnDateStarted
public static int CompareOnDateStarted(ActionBase action1, ActionBase action2)
{
int result = DateTime.Compare(action1.Started, action2.Started);
if (result == 0)
result = CompareOnStatus(action1, action2);
return result;
}
示例3: action_Completed
protected override void action_Completed(ActionBase sender)
{
EventHandler handler = Completed;
if (handler != null)
handler(this, new EventArgs());
base.action_Completed(sender);
}
示例4: CompareOnLocation
public static int CompareOnLocation(ActionBase action1, ActionBase action2)
{
string location1 = action1.GetLocation();
string location2 = action2.GetLocation();
int result = string.Compare(location1, location2);
if (result == 0)
result = CompareOnStatus(action1, action2);
return result;
}
示例5: action_Completed
protected virtual void action_Completed(ActionBase sender)
{
var action = (AsyncAction)sender;
if (action.Result == false.ToString())
MainWindowCommandInterface.Invoke(() =>
new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Information,
Messages.VIF_HOTPLUG_FAILED_MESSAGE,
Messages.VIF_HOTPLUG_FAILED_TITLE)).ShowDialog(Program.MainWindow));
}
示例6: Action_NewAction
private void Action_NewAction(ActionBase action)
{
if (action == null)
return;
Program.BeginInvoke(Program.MainWindow,
() =>
{
int count = ConnectionsManager.History.Count;
if (count >= MAX_HISTORY_ITEM)
ConnectionsManager.History.RemoveAt(0);
ConnectionsManager.History.Add(action);
});
}
示例7: action_CompletedTimeServer
void action_CompletedTimeServer(ActionBase sender)
{
GetServerTimeAction action = (GetServerTimeAction)sender;
Program.Invoke(Program.MainWindow, () =>
{
string serverLocalTimeString = action.Result;
if (serverLocalTimeString != "")
{
DateTime serverLocalTime = DateTime.Parse(serverLocalTimeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
serverLocalTimeString = HelpersGUI.DateTimeToString(serverLocalTime, Messages.DATEFORMAT_WDMY_HM_LONG, true);
}
labelServerTime.Text = string.Format(Messages.SERVER_TIME, serverLocalTimeString);
});
}
示例8: ActionRow
public ActionRow(ActionBase action)
{
AppliesTo = action.AppliesTo;
Action = action;
Image = action.GetImage();
TimeOccurred = HelpersGUI.DateTimeToString(Action.Started, Messages.DATEFORMAT_DMY_HMS, true);
CancelButtonClicked += CancelAction;
setupRowDetails();
if (!Action.IsCompleted)
{
Action.Changed += Action_Changed;
Action.Completed += Action_Completed;
}
}
示例9: ActionRow
public ActionRow(ActionBase action)
{
Type = action.Type;
AppliesTo = action.AppliesTo;
Action = action;
this.Image = getImage();
TimeOccurred = HelpersGUI.DateTimeToString(Action.Started, Messages.DATEFORMAT_DMY_HMS, true);
this.CancelButtonClicked += new EventHandler<EventArgs>(CancelAction);
setupRowDetails();
if (!Action.IsCompleted)
{
Action.Changed += new EventHandler<EventArgs>(Action_Changed);
Action.Completed += new EventHandler<EventArgs>(Action_Completed);
}
}
示例10: CompareOnStatus
/// <summary>
/// Ascending order:
/// 1. cancelled/failed
/// 2. lower state of completeness (smaller percentage completed)
/// 3. completed successfully
/// </summary>
/// <param name="action1"></param>
/// <param name="action2"></param>
/// <returns></returns>
public static int CompareOnStatus(ActionBase action1, ActionBase action2)
{
if (action1.IsCompleted && action2.IsCompleted)
{
if (action1.Succeeded && action2.Succeeded)
return 0;
if (!action1.Succeeded && !action2.Succeeded)
return 0;
if (!action1.Succeeded && action2.Succeeded)
return -1;
if (action1.Succeeded && !action2.Succeeded)
return 1;
}
if (!action1.IsCompleted && action2.IsCompleted)
return -1;
if (action1.IsCompleted && !action2.IsCompleted)
return 1;
return action1.PercentComplete.CompareTo(action2.PercentComplete);
}
示例11: getDataSorucesAction_Completed
void getDataSorucesAction_Completed(ActionBase sender)
{
Program.Invoke(this, delegate
{
GetDataSourcesAction action = sender as GetDataSourcesAction;
if (action != null)
{
List<DataSourceItem> dataSources = DataSourceItemList.BuildList(action.IXenObject, action.DataSources);
foreach (DataSourceItem dataSourceItem in dataSources)
{
bool displayOnGraph = designedGraph.DataSources.Contains(dataSourceItem);
dataGridView.Rows.Add(new DataSourceGridViewRow(dataSourceItem, displayOnGraph));
}
dataGridView.Sort(dataGridView.Columns[DisplayOnGraphColumnIndex], ListSortDirection.Ascending);
if (dataGridView.Rows.Count > 0)
{
dataGridView.Rows[0].Cells[DisplayOnGraphColumnIndex].Selected = true;
}
}
EnableControls();
});
}
示例12: snapshotAction_Completed
private void snapshotAction_Completed(ActionBase sender)
{
OnCompleted(new TakeSnapshotCommandCompletedEventArgs(sender.Succeeded));
}
示例13: SaveGraphs
private void SaveGraphs(ActionBase sender)
{
Program.Invoke(Program.MainWindow, delegate
{
var action = sender as GetDataSourcesAction;
if (action != null)
{
var dataSources = DataSourceItemList.BuildList(action.IXenObject, action.DataSources);
GraphList.SaveGraphs(dataSources);
}
});
}
示例14: action_Completed
private void action_Completed(ActionBase sender)
{
Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.EnableDisableEdit);
}
示例15: action_Completed
private void action_Completed(ActionBase sender)
{
Thread.Sleep(1000);
Program.Invoke(Program.MainWindow, RefreshRechecks);
}