本文整理汇总了C#中TaskDialog类的典型用法代码示例。如果您正苦于以下问题:C# TaskDialog类的具体用法?C# TaskDialog怎么用?C# TaskDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskDialog类属于命名空间,在下文中一共展示了TaskDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:29,代码来源:MainWindow.xaml.cs
示例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;
}
开发者ID:15921050052,项目名称:RevitLookup,代码行数:7,代码来源:TestCmds.cs
示例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));
}
}
开发者ID:zooba,项目名称:PTVS,代码行数:28,代码来源:CustomDebuggerEventHandler.cs
示例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");
}
}
开发者ID:RogovaTatiana,项目名称:FilesSync,代码行数:32,代码来源:MainWindow.xaml.cs
示例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;
}
开发者ID:jamiefarrell,项目名称:Panel-Schedules-to-Excel,代码行数:32,代码来源:HTMLTranslator.cs
示例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);
}
开发者ID:philippd,项目名称:userdialogs,代码行数:25,代码来源:UserDialogsImpl.cs
示例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;
}
开发者ID:tormodfj,项目名称:thumbler,代码行数:39,代码来源:VistaDialogProvider.cs
示例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);
}
}
开发者ID:DanqingYANG,项目名称:RevitLab,代码行数:27,代码来源:Application_DialogShowing.cs
示例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;
}
开发者ID:jeremytammik,项目名称:DirectShapeFromFace,代码行数:30,代码来源:Command.cs
示例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;
}
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:25,代码来源:Network.xaml.cs
示例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();
}
开发者ID:jeremytammik,项目名称:FireRatingCloud,代码行数:11,代码来源:Util.cs
示例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;
}
开发者ID:tilopfliegner,项目名称:revit,代码行数:10,代码来源:Class1.cs
示例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);
}
开发者ID:jefferywunady,项目名称:mobile-samples,代码行数:10,代码来源:controller_iPhone.cs
示例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);
}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:10,代码来源:HomeScreen.cs
示例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();
}
开发者ID:jeremytammik,项目名称:BipChecker,代码行数:14,代码来源:Util.cs
示例16: Execute
/// <summary>
/// Implement this method as an external command for Revit.
/// </summary>
/// <param name="commandData">An object that is passed to the external application
/// which contains data related to the command,
/// such as the application object and active view.</param>
/// <param name="message">A message that can be set by the external application
/// which will be displayed if a failure or cancellation is returned by
/// the external command.</param>
/// <param name="elements">A set of elements to which the external application
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
/// <returns>Return the status of the external command.
/// A result of Succeeded means that the API external method functioned as expected.
/// Cancelled can be used to signify that the user cancelled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public virtual Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData
, ref string message, Autodesk.Revit.DB.ElementSet elements)
{
Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document;
// get all PanelScheduleView instances in the Revit document.
FilteredElementCollector fec = new FilteredElementCollector(doc);
ElementClassFilter PanelScheduleViewsAreWanted = new ElementClassFilter(typeof(PanelScheduleView));
fec.WherePasses(PanelScheduleViewsAreWanted);
List<Element> psViews = fec.ToElements() as List<Element>;
bool noPanelScheduleInstance = true;
foreach (Element element in psViews)
{
PanelScheduleView psView = element as PanelScheduleView;
if (psView.IsPanelScheduleTemplate())
{
// ignore the PanelScheduleView instance which is a template.
continue;
}
else
{
noPanelScheduleInstance = false;
}
// choose what format export to, it can be CSV or HTML.
TaskDialog alternativeDlg = new TaskDialog("Choose Format to export");
alternativeDlg.MainContent = "Click OK to export in .CSV format, Cancel to export in HTML format.";
alternativeDlg.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel;
alternativeDlg.AllowCancellation = true;
TaskDialogResult exportToCSV = alternativeDlg.Show();
Translator translator = TaskDialogResult.Cancel == exportToCSV ? new HTMLTranslator(psView) : new CSVTranslator(psView) as Translator;
string exported = translator.Export();
// open the file if export successfully.
if (!string.IsNullOrEmpty(exported))
{
System.Diagnostics.Process.Start(exported);
}
}
if (noPanelScheduleInstance)
{
TaskDialog messageDlg = new TaskDialog("Warnning Message");
messageDlg.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
messageDlg.MainContent = "No panel schedule view is in the current document.";
messageDlg.Show();
return Result.Cancelled;
}
return Result.Succeeded;
}
开发者ID:jamiefarrell,项目名称:Panel-Schedules-to-Excel,代码行数:70,代码来源:PanelScheduleExport.cs
示例17: OnStartup
/// <summary>
/// Startup
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
public Result OnStartup(UIControlledApplication application)
{
try
{
// Version
if (!application.ControlledApplication.VersionName.Contains(RevitVersion))
{
using (TaskDialog td = new TaskDialog("Cannot Continue"))
{
td.TitleAutoPrefix = false;
td.MainInstruction = "Incompatible Revit Version";
td.MainContent = "This Add-In was built for Revit "+ RevitVersion + ", please contact CASE for assistance.";
td.Show();
}
return Result.Cancelled;
}
// Master Tab
const string c_tabName = "CASE";
try
{
// Create the Tab
application.CreateRibbonTab(c_tabName);
}
catch { }
string m_issuetracker = "Case.IssueTracker.dll";
// Tab
RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Case Issue Tracker");
// Button Data
PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
"Issue Tracker",
Path.Combine(_path, "Case.IssueTracker.Revit.dll"),
"Case.IssueTracker.Revit.Entry.CmdMain")) as PushButton;
// Images and Tooltip
if (m_pushButton != null)
{
m_pushButton.Image = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon16x16.png", m_issuetracker);
m_pushButton.LargeImage = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon32x32.png", m_issuetracker);
m_pushButton.ToolTip = "Case Issue Manager";
}
}
catch (Exception ex1)
{
MessageBox.Show("exception: " + ex1);
return Result.Failed;
}
return Result.Succeeded;
}
开发者ID:WeConnect,项目名称:issue-tracker,代码行数:59,代码来源:AppMain.cs
示例18: Execute
/// <summary>
/// Duct Command
/// </summary>
/// <param name="commandData"></param>
/// <param name="message"></param>
/// <param name="elements"></param>
/// <returns></returns>
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
// Version
if (!commandData.Application.Application.VersionName.Contains("2015"))
{
// Failure
using (TaskDialog td = new TaskDialog("Cannot Continue"))
{
td.TitleAutoPrefix = false;
td.MainInstruction = "Incompatible Revit Version";
td.MainContent = "This Add-In was built for Revit 2015, please contact CASE for assistance...";
td.Show();
}
return Result.Failed;
}
// Settings
clsSettings m_s = new clsSettings(commandData);
// Main Category Selection Form
using (form_Orient dlg = new form_Orient())
{
dlg.ShowDialog();
if (!dlg.DoConduit && !dlg.DoDuct && !dlg.DoPipe & !dlg.DoTray) return Result.Cancelled;
// Process Data
if (dlg.DoConduit) m_s.ProcessConduit();
if (dlg.DoDuct) m_s.ProcessDuct();
if (dlg.DoPipe) m_s.ProcessPipe();
if (dlg.DoTray) m_s.ProcessTray();
}
// Success
return Result.Succeeded;
}
catch (Exception ex)
{
// Failure
message = ex.Message;
return Result.Failed;
}
}
开发者ID:WeConnect,项目名称:case-apps,代码行数:59,代码来源:CmdMain.cs
示例19: NativeTaskDialog
/// <summary>Initializes a new instance of the <see cref="NativeTaskDialog" /> class.</summary>
/// <param name="settings">The settings.</param>
/// <param name="outerDialog">The outer dialog.</param>
internal NativeTaskDialog(NativeTaskDialogSettings settings, TaskDialog outerDialog)
{
nativeDialogConfig = settings.NativeConfiguration;
this.settings = settings;
// Wireup dialog proc message loop for this instance.
nativeDialogConfig.Callback = DialogProc;
ShowState = DialogShowState.PreShow;
// Keep a reference to the outer shell, so we can notify.
this.outerDialog = outerDialog;
}
开发者ID:robertbaker,项目名称:SevenUpdate,代码行数:16,代码来源:NativeTaskDialog.cs
示例20: Execute
/// <summary>
/// Command
/// </summary>
/// <param name="commandData"></param>
/// <param name="message"></param>
/// <param name="elements"></param>
/// <returns></returns>
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
// Version
if (!commandData.Application.Application.VersionName.Contains("2015"))
{
// Failure
using (TaskDialog m_td = new TaskDialog("Cannot Continue"))
{
m_td.TitleAutoPrefix = false;
m_td.MainInstruction = "Incompatible Version of Revit";
m_td.MainContent = "This Add-In was built for Revit 2015, please contact CASE for assistance.";
m_td.Show();
}
return Result.Cancelled;
}
Version m_version = typeof(CmdMain).Assembly.GetName().Version;
RegistryKey m_key = Registry.CurrentUser
.CreateSubKey(@"Software\CASE\Case.ParallelWalls\");
if (m_key != null && m_key.GetValue(m_version.ToString()) == null)
{
form_SplashScreen m_splash = new form_SplashScreen(m_key);
m_splash.ShowDialog();
}
clsElementSelection m_selection = new clsElementSelection(commandData.Application.ActiveUIDocument);
clsVectors m_vectors = new clsVectors(
m_selection.RefElement,
m_selection.WallElement);
clsWallTransform m_transform = new clsWallTransform(
m_selection.WallElement,
m_vectors.AxisLine,
m_vectors.DeltaAngle);
// Success
return Result.Succeeded;
}
catch (Exception m_ex)
{
// Failure
message = m_ex.Message;
return Result.Failed;
}
}
开发者ID:WeConnect,项目名称:case-apps,代码行数:58,代码来源:CmdMain.cs
注:本文中的TaskDialog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论