当前位置: 首页>>代码示例>>C#>>正文


C# Actions.ActionBase类代码示例

本文整理汇总了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);
            }
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:32,代码来源:ActivationRequestCommand.cs

示例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;
 }
开发者ID:heiden-deng,项目名称:xenadmin,代码行数:7,代码来源:ActionBaseExtensions.cs

示例3: action_Completed

        protected override void action_Completed(ActionBase sender)
        {
            EventHandler handler = Completed;

            if (handler != null)
                handler(this, new EventArgs());

            base.action_Completed(sender);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:9,代码来源:UpdateVIFCommand.cs

示例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;
        }
开发者ID:heiden-deng,项目名称:xenadmin,代码行数:10,代码来源:ActionBaseExtensions.cs

示例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));
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:11,代码来源:BaseVIFCommand.cs

示例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);
                           });
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:14,代码来源:HistoryPage.cs

示例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);
     });
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:14,代码来源:LocalServerTime.cs

示例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;
            }
        }
开发者ID:heiden-deng,项目名称:xenadmin,代码行数:15,代码来源:ActionRow.cs

示例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);
     }
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:15,代码来源:ActionRow.cs

示例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);
        }
开发者ID:heiden-deng,项目名称:xenadmin,代码行数:31,代码来源:ActionBaseExtensions.cs

示例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();
            });
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:23,代码来源:GraphDetailsDialog.cs

示例12: snapshotAction_Completed

 private void snapshotAction_Completed(ActionBase sender)
 {
     OnCompleted(new TakeSnapshotCommandCompletedEventArgs(sender.Succeeded));
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:4,代码来源:TakeSnapshotCommand.cs

示例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);
         }
     });
 }
开发者ID:aaroneg,项目名称:xenadmin,代码行数:12,代码来源:PerformancePage.cs

示例14: action_Completed

 private void action_Completed(ActionBase sender)
 {
     Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.EnableDisableEdit);
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:4,代码来源:PropertiesDialog.cs

示例15: action_Completed

 private void action_Completed(ActionBase sender)
 {
     Thread.Sleep(1000);
     Program.Invoke(Program.MainWindow, RefreshRechecks);
 }
开发者ID:robhoes,项目名称:xenadmin,代码行数:5,代码来源:PatchingWizard_PrecheckPage.cs


注:本文中的XenAdmin.Actions.ActionBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。