本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例3: OnClosing
protected override void OnClosing(CancelEventArgs e)
{
string json = _jsonSerializer.Serialize(_storageAccountConnections);
File.WriteAllText(SettingsFilePath, json);
_deploymentConfigFileWatcher.Dispose();
base.OnClosing(e);
}
示例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;
}
示例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";
}
}
示例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;
}
示例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);
}
示例8: OnClosing
protected override void OnClosing(CancelEventArgs e)
{
if (_connector != null)
_connector.Dispose();
base.OnClosing(e);
}
示例9: OnBackKeyPress
protected override void OnBackKeyPress(CancelEventArgs e)
{
base.OnBackKeyPress(e);
if (!e.Cancel && !ConfirmNavigateAway())
e.Cancel = true;
}
示例10: OnClosing
protected override void OnClosing(CancelEventArgs e)
{
App.MainController.Logout(() =>
{
base.OnClosing(e);
});
}
示例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);
}
}
示例12: HistoricViewer_OnClosing
private void HistoricViewer_OnClosing (object Sender, CancelEventArgs E)
{
foreach (ResultViewer OpenResult in ListOfOpenResultViewer)
{
OpenResult.DoFinalClose ();
}
}
示例13: OnClosing
protected override void OnClosing( CancelEventArgs e )
{
if ( !e.Cancel ) {
CommandRunner.Instance.TopProcessKill ( );
}
base.OnClosing ( e );
}
示例14: OnClosing
protected override void OnClosing(CancelEventArgs e)
{
e.Cancel = !_DoClose;
base.OnClosing(e);
Program.Status.VideoScreenVisible = false;
Hide();
}
示例15: Window_OnClosing
private void Window_OnClosing(object sender, CancelEventArgs e)
{
var vm = (FocusTrackerToolWindowViewModel)this.DataContext;
vm.Remove();
//((ToolWindow)sender).Hide();
//e.Cancel = true;
}