本文整理汇总了C#中TaskDialog类的典型用法代码示例。如果您正苦于以下问题:C# TaskDialog类的具体用法?C# TaskDialog怎么用?C# TaskDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskDialog类属于命名空间,在下文中一共展示了TaskDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClosing
protected override void OnClosing(CancelEventArgs e)
{
var rMode = Preference.Instance.UI.CloseConfirmationMode.Value;
if (rMode == ConfirmationMode.Always || (rMode == ConfirmationMode.DuringSortie && KanColleGame.Current.Sortie is SortieInfo))
{
var rDialog = new TaskDialog()
{
Caption = StringResources.Instance.Main.Product_Name,
Instruction = StringResources.Instance.Main.Window_ClosingConfirmation_Instruction,
Icon = TaskDialogIcon.Information,
Buttons =
{
new TaskDialogCommandLink(TaskDialogCommonButton.Yes, StringResources.Instance.Main.Window_ClosingConfirmation_Button_Yes),
new TaskDialogCommandLink(TaskDialogCommonButton.No, StringResources.Instance.Main.Window_ClosingConfirmation_Button_No),
},
DefaultCommonButton = TaskDialogCommonButton.No,
OwnerWindow = this,
ShowAtTheCenterOfOwner = true,
};
if (rDialog.ShowAndDispose().ClickedCommonButton == TaskDialogCommonButton.No)
{
e.Cancel = true;
return;
}
}
base.OnClosing(e);
}
示例2: Execute
public Result Execute( Autodesk.Revit.UI.ExternalCommandData cmdData, ref string msg, ElementSet elems )
{
TaskDialog helloDlg = new TaskDialog( "Autodesk Revit" );
helloDlg.MainContent = "Hello World from " + System.Reflection.Assembly.GetExecutingAssembly().Location;
helloDlg.Show();
return Result.Cancelled;
}
示例3: WarnAboutPythonSymbols
private void WarnAboutPythonSymbols(string moduleName) {
const string content =
"Python/native mixed-mode debugging requires symbol files for the Python interpreter that is being debugged. Please add the folder " +
"containing those symbol files to your symbol search path, and force a reload of symbols for {0}.";
var dialog = new TaskDialog(_serviceProvider);
var openSymbolSettings = new TaskDialogButton("Open symbol settings dialog");
var downloadSymbols = new TaskDialogButton("Download symbols for my interpreter");
dialog.Buttons.Add(openSymbolSettings);
dialog.Buttons.Add(downloadSymbols);
dialog.Buttons.Add(TaskDialogButton.Close);
dialog.UseCommandLinks = true;
dialog.Title = "Python Symbols Required";
dialog.Content = string.Format(content, moduleName);
dialog.Width = 0;
dialog.ShowModal();
if (dialog.SelectedButton == openSymbolSettings) {
var cmdId = new CommandID(VSConstants.GUID_VSStandardCommandSet97, VSConstants.cmdidToolsOptions);
_serviceProvider.GlobalInvoke(cmdId, "1F5E080F-CBD2-459C-8267-39fd83032166");
} else if (dialog.SelectedButton == downloadSymbols) {
PythonToolsPackage.OpenWebBrowser(
string.Format("http://go.microsoft.com/fwlink/?LinkId=308954&clcid=0x{0:X}", CultureInfo.CurrentCulture.LCID));
}
}
示例4: ShowTaskDialog
private void ShowTaskDialog()
{
if( TaskDialog.OSSupportsTaskDialogs )
{
using( TaskDialog dialog = new TaskDialog() )
{
dialog.WindowTitle = "Task dialog sample";
dialog.MainInstruction = "This is an example task dialog.";
dialog.Content = "Task dialogs are a more flexible type of message box. Among other things, task dialogs support custom buttons, command links, scroll bars, expandable sections, radio buttons, a check box (useful for e.g. \"don't show this again\"), custom icons, and a footer. Some of those things are demonstrated here.";
dialog.ExpandedInformation = "Ookii.org's Task Dialog doesn't just provide a wrapper for the native Task Dialog API; it is designed to provide a programming interface that is natural to .Net developers.";
dialog.Footer = "Task Dialogs support footers and can even include <a href=\"http://www.ookii.org\">hyperlinks</a>.";
dialog.FooterIcon = TaskDialogIcon.Information;
dialog.EnableHyperlinks = true;
TaskDialogButton customButton = new TaskDialogButton("A custom button");
TaskDialogButton okButton = new TaskDialogButton(ButtonType.Ok);
TaskDialogButton cancelButton = new TaskDialogButton(ButtonType.Cancel);
dialog.Buttons.Add(customButton);
dialog.Buttons.Add(okButton);
dialog.Buttons.Add(cancelButton);
dialog.HyperlinkClicked += new EventHandler<HyperlinkClickedEventArgs>(TaskDialog_HyperLinkClicked);
TaskDialogButton button = dialog.ShowDialog(this);
if( button == customButton )
MessageBox.Show(this, "You clicked the custom button", "Task Dialog Sample");
else if( button == okButton )
MessageBox.Show(this, "You clicked the OK button.", "Task Dialog Sample");
}
}
else
{
MessageBox.Show(this, "This operating system does not support task dialogs.", "Task Dialog Sample");
}
}
示例5: Export
/// <summary>
/// export to a HTML page that contains the PanelScheduleView instance data.
/// </summary>
/// <returns>the exported file path</returns>
public override string Export()
{
string asemblyName = System.Reflection.Assembly.GetExecutingAssembly().Location;
string tempFile = asemblyName.Replace("PanelSchedule.dll", "template.html");
if (!System.IO.File.Exists(tempFile))
{
TaskDialog messageDlg = new TaskDialog("Warnning Message");
messageDlg.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
messageDlg.MainContent = "Can not find 'template.html', please make sure the 'template.html' file is in the same folder as the external command assembly.";
messageDlg.Show();
return null;
}
string panelScheduleFile = asemblyName.Replace("PanelSchedule.dll", ReplaceIllegalCharacters(m_psView.Name) + ".html");
XmlDocument doc = new XmlDocument();
XmlTextWriter tw = new XmlTextWriter(panelScheduleFile, null);
doc.Load(tempFile);
XmlNode psTable = doc.DocumentElement.SelectSingleNode("//div/table[1]");
DumpPanelScheduleData(psTable, doc);
doc.Save(tw);
return panelScheduleFile;
}
示例6: Confirm
public override IDisposable Confirm(ConfirmConfig config)
{
var dlg = new TaskDialog
{
WindowTitle = config.Title,
Content = config.Message,
Buttons =
{
new TaskDialogButton(config.CancelText)
{
ButtonType = ButtonType.Cancel
},
new TaskDialogButton(config.OkText)
{
ButtonType = ButtonType.Ok
}
}
};
dlg.ButtonClicked += (sender, args) =>
{
var ok = ((TaskDialogButton)args.Item).ButtonType == ButtonType.Ok;
config.OnAction(ok);
};
return new DisposableAction(dlg.Dispose);
}
示例7: AskToCreateFolder
/// <summary>
/// Shows a dialog asking the user whether she want to create the
/// specified folder.
/// </summary>
/// <param name="path">The folder path.</param>
/// <returns>
/// <c>true</c> is user wants to create folder; otherwise <c>false</c>.
/// </returns>
public bool AskToCreateFolder(string path)
{
const string createButtonName = "create";
const string cancelButtonName = "cancel";
TaskDialog dialog = new TaskDialog
{
Caption = "Create folder?",
Instruction = "Create folder?",
Content = "The folder \"" + path + "\" does not exist.",
MainIcon = TaskDialogStandardIcon.Warning,
Controls =
{
new TaskDialogCommandLink
{
Text = "Create Folder",
Instruction = "This will create the folder for you and start the image resizing.",
Name = createButtonName
},
new TaskDialogCommandLink
{
Text = "Cancel",
Instruction = "This will cancel the operation and let you choose another output folder.",
Name = cancelButtonName
}
}
};
TaskDialogResult result = dialog.Show();
return result.CustomButtonClicked == createButtonName;
}
示例8: AppDialogShowing
public void AppDialogShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs arg)
{
//get the help id of the showing dialog
int dialogId = arg.HelpId;
//Format the prompt information string
string promptInfo = "lalala";
promptInfo += "HelpId : " + dialogId.ToString();
//Show the prompt information and allow the user close the dialog directly
TaskDialog td = new TaskDialog("taskDialog1");
td.MainContent = promptInfo;
TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Ok| TaskDialogCommonButtons.Cancel;
td.CommonButtons = buttons;
//??liuzbkuv mjhglku
TaskDialogResult tdr = td.Show();
if (TaskDialogResult.Cancel == tdr)
{
//Do not show the Revit dialog
arg.OverrideResult(1);
}
else
{
//Continue to show the Revit dialog
arg.OverrideResult(0);
}
}
示例9: Execute
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
var dialog = new TaskDialog( "Create DirectShape" )
{
MainInstruction = "Select the way you want to create shape"
};
dialog.AddCommandLink( TaskDialogCommandLinkId.CommandLink1, "Initial shape builder" );
dialog.AddCommandLink( TaskDialogCommandLinkId.CommandLink2, "Jeremy's shape builder" );
dialog.AddCommandLink( TaskDialogCommandLinkId.CommandLink3, "Simple shape builder" );
switch( dialog.Show() )
{
case TaskDialogResult.CommandLink1:
CreateDirectShapeInitial.Execute1( commandData );
break;
case TaskDialogResult.CommandLink2:
CreateDirectShape.Execute( commandData );
break;
case TaskDialogResult.CommandLink3:
CreateDirectShapeSimple.Execute( commandData );
break;
}
return Result.Succeeded;
}
示例10: EnablePortCustomization_Checked
void EnablePortCustomization_Checked(object sender, RoutedEventArgs e)
{
if (!EnablePortCustomization.IsChecked.Value)
return;
var rDialog = new TaskDialog()
{
Caption = StringResources.Instance.Main.Product_Name,
Instruction = StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Instruction,
Icon = TaskDialogIcon.Information,
Content = StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Content,
Buttons =
{
new TaskDialogButton(TaskDialogCommonButton.Yes, StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Button_Yes),
new TaskDialogButton(TaskDialogCommonButton.No, StringResources.Instance.Main.PreferenceWindow_Network_Port_Customization_Dialog_Button_No),
},
DefaultCommonButton = TaskDialogCommonButton.No,
OwnerWindow = WindowUtil.GetTopWindow(),
ShowAtTheCenterOfOwner = true,
};
if (rDialog.Show().ClickedCommonButton == TaskDialogCommonButton.No)
EnablePortCustomization.IsChecked = false;
}
示例11: ErrorMsg
/// <summary>
/// Display an error message.
/// </summary>
public static void ErrorMsg( string msg )
{
Util.Log( msg );
TaskDialog dlg = new TaskDialog( App.Caption );
dlg.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
dlg.MainInstruction = msg;
dlg.Show();
}
示例12: Execute
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
ref string message, Autodesk.Revit.DB.ElementSet elements)
{
TaskDialog dlg = new TaskDialog(@"Hello Revit");
dlg.MainContent = @"Hello Revit";
dlg.MainInstruction = @"Say hello!";
dlg.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, @"Hello");
dlg.Show();
return Autodesk.Revit.UI.Result.Succeeded;
}
示例13: ShowTaskDetails
protected void ShowTaskDetails (TaskItem taskItem)
{
currentTaskItem = taskItem;
taskItemDialog = new TaskDialog (taskItem);
var title = Foundation.NSBundle.MainBundle.LocalizedString ("Task Details", "Task Details");
context = new LocalizableBindingContext (this, taskItemDialog, title);
detailsScreen = new DialogViewController (context.Root, true);
ActivateController(detailsScreen);
}
示例14: ShowTaskDetails
protected void ShowTaskDetails(Task task)
{
currentTask = task;
taskDialog = new TaskDialog(task);
string title = NSBundle.MainBundle.LocalizedString("Task Details", "Task Details");
context = new LocalizableBindingContext(this, taskDialog, title);
detailsScreen = new DialogViewController(context.Root, true);
ActivateController(detailsScreen);
}
示例15: ErrorMsg
/// <summary>
/// MessageBox wrapper for error message.
/// </summary>
public static void ErrorMsg( string msg )
{
Debug.WriteLine( msg );
//WinForms.MessageBox.Show( msg, Caption, WinForms.MessageBoxButtons.OK, WinForms.MessageBoxIcon.Error );
TaskDialog d = new TaskDialog( Caption );
d.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
d.MainInstruction = msg;
d.Show();
}