当前位置: 首页>>代码示例>>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;未经允许,请勿转载。