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


C# CancelEventArgs类代码示例

本文整理汇总了C#中CancelEventArgs的典型用法代码示例。如果您正苦于以下问题:C# CancelEventArgs类的具体用法?C# CancelEventArgs怎么用?C# CancelEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CancelEventArgs类属于命名空间,在下文中一共展示了CancelEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ctxObjects_Opening

 private void ctxObjects_Opening(object sender, CancelEventArgs e)
 {
   if (this.viewer == null)
   {
     e.Cancel = true;
   }
   else
   {
     switch (this.listView.SelectedIndices.Count)
     {
       case 0:
         this.ctxObjects_Add.Enabled = true;
         this.ctxObjects_Edit.Enabled = false;
         this.ctxObjects_Delete.Enabled = false;
         break;
       case 1:
         this.ctxObjects_Add.Enabled = true;
         this.ctxObjects_Edit.Enabled = true;
         this.ctxObjects_Delete.Enabled = true;
         break;
       default:
         this.ctxObjects_Add.Enabled = true;
         this.ctxObjects_Edit.Enabled = false;
         this.ctxObjects_Delete.Enabled = true;
         break;
     }
   }
 }
开发者ID:smther,项目名称:FreeOQ,代码行数:28,代码来源:DataSeriesViewer.cs

示例2: mainWindow_Closing

        // Closing
        private void mainWindow_Closing(object sender, CancelEventArgs e)
        {
            // If the document needs to be saved
            if (_needsToBeSaved)
            {
                // Configure the message box
                var messageBoxText =
                    "This document needs to be saved. Click Yes to save and exit, No to exit without saving, or Cancel to not exit.";
                var caption = "Word Processor";
                var button = MessageBoxButton.YesNoCancel;
                var icon = MessageBoxImage.Warning;

                // Display message box
                var messageBoxResult = MessageBox.Show(messageBoxText, caption, button, icon);

                // Process message box results
                switch (messageBoxResult)
                {
                    case MessageBoxResult.Yes: // Save document and exit
                        SaveDocument();
                        break;
                    case MessageBoxResult.No: // Exit without saving
                        break;
                    case MessageBoxResult.Cancel: // Don't exit
                        e.Cancel = true;
                        break;
                }
            }
        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:30,代码来源:MainWindow.cs

示例3: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     string json = _jsonSerializer.Serialize(_storageAccountConnections);
     File.WriteAllText(SettingsFilePath, json);
     _deploymentConfigFileWatcher.Dispose();
     base.OnClosing(e);
 }
开发者ID:Microsoft,项目名称:Yams,代码行数:7,代码来源:MainWindow.xaml.cs

示例4: ValidateTextBox

        private void ValidateTextBox( object sender, CancelEventArgs e )
        {
            bool nameValid = true, passwordValid = true;

              if (String.IsNullOrEmpty(((TextBox)sender).Text))
              {
            switch (Convert.ToByte(((TextBox)sender).Tag))
            {
              case 0:
            errorProvider1.SetError(tbName, "Please, enter your name");
            nameValid = false;
            break;
              case 1:
            errorProvider1.SetError(tbPassword, "Please, enter your password");
            passwordValid = false;
            break;
            }
              }
              else
              {
            switch (Convert.ToByte(((TextBox)sender).Tag))
            {
              case 0:
            errorProvider1.SetError(tbName, "");
            break;
              case 1: errorProvider1.SetError(tbPassword, "");
            break;
            }
              }
              _validForm = nameValid && passwordValid;
        }
开发者ID:ericzhc,项目名称:gprs-system-tiger,代码行数:31,代码来源:FLogin.cs

示例5: openFileDialog1_FileOk

 private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
 {
     string linija = "";
     int broj = 0;
     bool ide = true;
     try
     {
         using (StreamReader sr = new StreamReader(openFileDialog1.FileName))
         {
             while (ide)
             {
                 linija = sr.ReadLine();
                 if (linija == null) ide = false;
                 string prezime = linija.Split(',')[0];
                 string ime = linija.Split(',')[1];
                 broj++;
                 Igrac igrac_za_unos = new Igrac(ime, prezime);
                 Igrac_GA igrac_za_unos_GA = new Igrac_GA();
                 igrac_za_unos_GA.Daj_Ime_i_prezime = ime + " " + prezime;
                 lista_za_upis.Add(igrac_za_unos);
                 lista_Za_upis_GA.Add(igrac_za_unos_GA);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("The file could not be read:");
         Console.WriteLine(ex.Message);
     }
     foreach (Igrac i in lista_za_upis)
     {
         richTextBox1.Text += lista_za_upis.IndexOf(i) + ". " + i + " \n";
     }
 }
开发者ID:kleitz,项目名称:statstron,代码行数:34,代码来源:FileIgraci.cs

示例6: OnClosing

        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            //Settings Save
            Settings.Default.gpxLastSummary = chExportSummary.Checked;
            Settings.Default.gpxLastComprehensive = chExportComp.Checked;
            Settings.Default.gpxLastEachAp = chExportEachAp.Checked;

            Settings.Default.gpxLastOrganizeEThenC = cmbOrganize.SelectedIndex == 0;

            Settings.Default.gpxLastRssiLabels = chShowRssiMarkers.Checked;

            Settings.Default.gpxLastGpsLockedup = chGPSLockup.Checked;
            Settings.Default.gpxLastGpsFixLost = chGPSFixLost.Checked;
            Settings.Default.gpxLastMinimumSatsEnabled = chGPSsatCount.Checked;
            Settings.Default.gpxLastMinimumStas = (int)numSatCount.Value;

            Settings.Default.gpxLastMaxSpeedEnabled = chMaxSpeed.Checked;
            Settings.Default.gpxLastMaxSpeed = (int)numMaxSpeed.Value;

            Settings.Default.gpxLastMaxRssiEnabled = chMaxSignal.Checked;
            Settings.Default.gpxLastMaxRssi = (int)numMaxSignal.Value;

            //Save input file(s)
            //(Settings.Default.gpxLastInputFiles ?? (Settings.Default.gpxLastInputFiles = new StringCollection())).AddRange(openFile.FileNames);
            if (_inFiles != null)
            {
                (Settings.Default.gpxLastInputFiles = new StringCollection()).AddRange(_inFiles);
            }

            Settings.Default.gpxLastOutputDir = txtOutDir.Text;
        }
开发者ID:ashokgelal,项目名称:inSSIDer-2,代码行数:33,代码来源:frmLogConverter.cs

示例7: OnClosing

		protected override void OnClosing(CancelEventArgs e)
		{
			if (_token != null)
			{
				if (Sync.IsEnabled)
				{
					var result =
						new MessageBoxBuilder()
							.Text(LocalizedStrings.Str2928)
							.Error()
							.YesNo()
							.Owner(this)
							.Show();

					if (result == MessageBoxResult.Yes)
					{
						StopSync();
					}
				}

				e.Cancel = true;
			}

			base.OnClosing(e);
		}
开发者ID:carlosaduro,项目名称:StockSharp,代码行数:25,代码来源:SynchronizeWindow.xaml.cs

示例8: OnClosing

		protected override void OnClosing(CancelEventArgs e)
		{
			if (_connector != null)
				_connector.Dispose();

			base.OnClosing(e);
		}
开发者ID:jackman0925,项目名称:StockSharp,代码行数:7,代码来源:MainWindow.xaml.cs

示例9: OnBackKeyPress

        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            base.OnBackKeyPress(e);

            if (!e.Cancel && !ConfirmNavigateAway())
                e.Cancel = true;
        }
开发者ID:nthobois,项目名称:7Pass,代码行数:7,代码来源:EntryDetails.xaml.cs

示例10: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     App.MainController.Logout(() =>
     {
         base.OnClosing(e);
     });
 }
开发者ID:kalantyr,项目名称:Parallel,代码行数:7,代码来源:MainWindow.xaml.cs

示例11: openKeyFileDialog_FileOk

        private void openKeyFileDialog_FileOk(object sender, CancelEventArgs e)
        {
            BIFTreeView.Nodes.Clear();

            try
            {

                pathContext = Path.GetDirectoryName(openKeyFileDialog.FileName) + "\\";
                String modName = Path.GetFileName(openKeyFileDialog.FileName);
                BIF_KEY tannen = new BIF_KEY(pathContext + modName);

                foreach (BIF_FILETABLE_ENTRY file in tannen.FILETABLE)
                {
                    TreeNode BIFLevelNode = new TreeNode(file.BIFName);

                    foreach (BIF_KEYTABLE_ENTRY key in file.ownedResources)
                    {
                        TreeNode ResourceLevelNode = new TreeNode(BIF_Utility.makeNewResName(key.ResourceName, key.ResourceType));
                        ResourceLevelNode.Tag = key;
                        BIFLevelNode.Nodes.Add(ResourceLevelNode);
                    }
                    BIFTreeView.Nodes.Add(BIFLevelNode);
                }
            }
            catch (FileNotFoundException ee)
            {
                MessageBox.Show("There was a problem reading the BIF index (KEY) file: \r\n"
                    + ee.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:returns-null,项目名称:GeraltOfBIFFia,代码行数:30,代码来源:BIFTool.cs

示例12: HistoricViewer_OnClosing

		private void HistoricViewer_OnClosing (object Sender, CancelEventArgs E)
			{
			foreach (ResultViewer OpenResult in ListOfOpenResultViewer)
				{
				OpenResult.DoFinalClose ();
				}
			}
开发者ID:heinzsack,项目名称:DEV,代码行数:7,代码来源:HistoricViewer.xaml.cs

示例13: OnClosing

 protected override void OnClosing( CancelEventArgs e )
 {
     if ( !e.Cancel ) {
     CommandRunner.Instance.TopProcessKill ( );
       }
       base.OnClosing ( e );
 }
开发者ID:camalot,项目名称:droidexplorer,代码行数:7,代码来源:ProcessViewerForm.cs

示例14: OnClosing

 protected override void OnClosing(CancelEventArgs e)
 {
     e.Cancel = !_DoClose;
     base.OnClosing(e);
     Program.Status.VideoScreenVisible = false;
     Hide();
 }
开发者ID:OpenJinglePlayer,项目名称:OpenJinglePlayer,代码行数:7,代码来源:VideoWindow.cs

示例15: Window_OnClosing

 private void Window_OnClosing(object sender, CancelEventArgs e)
 {
     var vm = (FocusTrackerToolWindowViewModel)this.DataContext;
     vm.Remove();
     //((ToolWindow)sender).Hide();
     //e.Cancel = true;
 }
开发者ID:Robotonics,项目名称:AllJoyn-Weahter-station,代码行数:7,代码来源:FocusTrackerWindow.xaml.cs


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