當前位置: 首頁>>代碼示例>>C#>>正文


C# ComponentModel.CancelEventArgs類代碼示例

本文整理匯總了C#中System.ComponentModel.CancelEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# CancelEventArgs類的具體用法?C# CancelEventArgs怎麽用?C# CancelEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CancelEventArgs類屬於System.ComponentModel命名空間,在下文中一共展示了CancelEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Window_Closing

        private void Window_Closing(object sender, CancelEventArgs e)
        {
            var model = (MusicViewModel) DataContext;
            model.SaveIfDirty();

            SaveSettings();
        }
開發者ID:dmacuk,項目名稱:MusicPicker,代碼行數:7,代碼來源:MainWindow.xaml.cs

示例2: textBox_Validating

 private void textBox_Validating(object sender, CancelEventArgs e) {
   var textBox = (TextBox)sender;
   decimal value = 0;
   if (allowOnlyInteger) {
     int intValue;
     if (!int.TryParse(textBox.Text, out intValue)) {
       errorProvider.SetError(textBox, "Please enter a valid integer value.");
       e.Cancel = true;
       return;
     } else {
       value = intValue;
       errorProvider.SetError(textBox, null);
     }
   } else {
     if (!decimal.TryParse(textBox.Text, NumberStyles.Float, CultureInfo.CurrentCulture.NumberFormat, out value)) {
       errorProvider.SetError(textBox, "Please enter a valid double value.");
       e.Cancel = true;
       return;
     } else errorProvider.SetError(textBox, null);
   }
   if (textBox == minimumTextBox) Minimum = value;
   else if (textBox == maximumTextBox) Maximum = value;
   else if (textBox == stepSizeTextBox) Step = value;
   okButton.Enabled = IsValid();
 }
開發者ID:t-h-e,項目名稱:HeuristicLab,代碼行數:25,代碼來源:DefineArithmeticProgressionDialog.cs

示例3: Close

 private void Close(object sender, CancelEventArgs e)
 {
     if (_kinectSensor != null)
     {
         _kinectSensor.Close();
     }
 }
開發者ID:franklinNCAT,項目名稱:KinectPulseMonitor,代碼行數:7,代碼來源:MainWindow.xaml.cs

示例4: OnClosing

 private void OnClosing(object sender, CancelEventArgs e)
 {
     if (!App.Locator.MainWindow.IsAuth)
     {
         this.Close();
     }
 }
開發者ID:AndrewNikolin,項目名稱:vk-export,代碼行數:7,代碼來源:MainWindow.xaml.cs

示例5: WindowClosing

 private void WindowClosing(object sender, CancelEventArgs e)
 {
     if(!Validate())
     {
         e.Cancel = true;
     }
 }
開發者ID:FerdinandOlivier,項目名稱:Warewolf-ESB,代碼行數:7,代碼來源:GetStringValueWindow.xaml.cs

示例6: Window_OnClosing

 private void Window_OnClosing(object sender, CancelEventArgs e)
 {
     var vm = (ElementListToolWindowViewModel)this.DataContext;
     vm.Remove();
     //((ToolWindow)sender).Hide();
     //e.Cancel = true;
 }
開發者ID:siatwangmin,項目名稱:WinRTXamlToolkit,代碼行數:7,代碼來源:ElementListWindow.xaml.cs

示例7: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     RegisterOprate.SaveRegData(KeyName, tabs.SelectedIndex);
     if (MessageBox.Show("確認退出?", "請確認", MessageBoxButtons.YesNo) == DialogResult.No)
         e.Cancel = true;
     base.OnClosing(e);
 }
開發者ID:dalinhuang,項目名稱:shool-card,代碼行數:7,代碼來源:Library.cs

示例8: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     if (null == mDockUrl)
     {
         e.Cancel = false;
     }
     else if (mDockUrl._isDirty())
     {
         string dockUrlName_ = mDockUrl._getDockUrlName();
         if (null == dockUrlName_ || "" == dockUrlName_)
         {
             dockUrlName_ = "untitle";
         }
         DialogResult dialogResult_ = MessageBox.Show("是否保存?", dockUrlName_, MessageBoxButtons.OKCancel);
         if (dialogResult_ == DialogResult.OK)
         {
             mDockUrl._runSave();
             mDockUrl._runClose();
             e.Cancel = false;
         }
         else
         {
             e.Cancel = true;
         }
     }
     else
     {
         mDockUrl._runClose();
         e.Cancel = false;
     }
     base.OnClosing(e);
 }
開發者ID:zyouhua,項目名稱:weilai,代碼行數:32,代碼來源:DockFrame.cs

示例9: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     base.OnClosing(e);
     e.Cancel = true;
     Hide();
     formControl.buttonShowGraph.Text = "Показать график";
 }
開發者ID:EmbeddedSystem,項目名稱:Regis_CSharp,代碼行數:7,代碼來源:FormGraph.cs

示例10: MainWindowClosing

        /// <summary> Shuts down the application when the main window closes. </summary>
        /// <param name="sender"> The sender.  </param>
        /// <param name="e"> The event arguments.  </param>
        private void MainWindowClosing(object sender, CancelEventArgs e)
        {
            var vm = (MainWindowViewModel)this.DataContext;
            vm.SaveSettings();

            Application.Current.Shutdown();
        }
開發者ID:ascendedguard,項目名稱:starboard-dota2,代碼行數:10,代碼來源:MainWindowView.xaml.cs

示例11: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     //Prevent disposal of dialog
     e.Cancel = true;
     base.OnClosing(e);
     Hide();
 }
開發者ID:crazymouse0,項目名稱:SharperGps,代碼行數:7,代碼來源:FrmGpsSettings.cs

示例12: OnClosing

        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            if (checkBox1.Checked)
            {
                // User clicked 'ignore': set flag in VM.
                log.DebugFormat("Setting IgnoreExcessiveVcpus flag to true for VM {0}", vm.Name);

                VM copyVM = (VM)vm.Clone();
                copyVM.IgnoreExcessiveVcpus = true;
                // Save changes to server
                try
                {
                    vm.Locked = true;
                    copyVM.SaveChanges(vm.Connection.Session);
                }
                finally
                {
                    vm.Locked = false;
                }
            }
            else
            {
                // Select VM's settings (a.k.a. 'general') tab
                if (Program.MainWindow.SelectObject(this.vm))
                    Program.MainWindow.SwitchToTab(MainWindow.Tab.Settings);
            }
        }
開發者ID:huizh,項目名稱:xenadmin,代碼行數:28,代碼來源:VcpuWarningDialog.cs

示例13: MammaView_OnClosing

 private void MammaView_OnClosing(object sender, CancelEventArgs e)
 {
     var viewModel = DataContext as MammaViewModel;
     if (viewModel != null && viewModel.SaveCommand.CanExecute(null))
     {
         var dialogResult = MessageBox.Show("Есть несохраненные изменения. Сохранить их?", "УЗД молочной железы",
             MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Yes);
         switch (dialogResult)
         {
             case MessageBoxResult.Yes:
                 viewModel.SaveCommand.Execute(null);
                 break;
             case MessageBoxResult.Cancel:
                 e.Cancel = true;
                 break;
         }
     }
     else
     {
         var dialogResult = MessageBox.Show("Вы уверны, что хотите выйти?", "УЗД молочной железы",
             MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes);
         if (dialogResult == MessageBoxResult.No)
         {
             e.Cancel = true;
         }
     }
 }
開發者ID:burukinsd,項目名稱:USD,代碼行數:27,代碼來源:MammaView.xaml.cs

示例14: OnNotInList

 protected virtual void OnNotInList(CancelEventArgs e)
 {
     if (NotInList != null)
     {
         NotInList(this, e);
     }
 }
開發者ID:burritowarrior,項目名稱:EFDemo,代碼行數:7,代碼來源:AutoCompleteComboBox.cs

示例15: OnLogConsoleWindowClosing

 void OnLogConsoleWindowClosing( object sender, CancelEventArgs e )
 {
     e.Cancel = true;
     _logConsoleWindow.Visibility = System.Windows.Visibility.Collapsed;
     _consoleWindowIsClosed = true;
     OnPropertyChanged( "IsMaximized" );
 }
開發者ID:Invenietis,項目名稱:ck-certified,代碼行數:7,代碼來源:VMLogOutputContainer.cs


注:本文中的System.ComponentModel.CancelEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。