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