當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。