本文整理汇总了C#中TaskDialog.Show方法的典型用法代码示例。如果您正苦于以下问题:C# TaskDialog.Show方法的具体用法?C# TaskDialog.Show怎么用?C# TaskDialog.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskDialog
的用法示例。
在下文中一共展示了TaskDialog.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例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: 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;
}
示例4: 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);
}
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
示例8: 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;
}
示例9: 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();
}
示例10: 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;
}
示例11: 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;
}
}
示例12: Execute
/// <summary>
/// Report Groups by View
/// </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 Version of Revit";
td.MainContent = "This Add-In was built for Revit 2015, please contact CASE for assistance.";
td.Show();
}
return Result.Cancelled;
}
// Settings
clsSettings m_s = new clsSettings(commandData);
if (m_s.ModelGroups.Count + m_s.DetailGroups.Count < 1)
{
using (TaskDialog td = new TaskDialog("No Groups Found"))
{
td.TitleAutoPrefix = false;
td.MainInstruction = "No Groups Found";
td.Show();
}
return Result.Cancelled;
}
// Form
using (form_Main d = new form_Main(m_s))
{
d.ShowDialog();
}
// Success
return Result.Succeeded;
}
catch (Exception ex)
{
// Failure
message = ex.Message;
return Result.Failed;
}
}
示例13: 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;
}
}
示例14: AskYesNoQuestion
/// <summary>
/// Shows a question dialog with Yes/No buttons.
/// </summary>
/// <param name="title">The title of the question.</param>
/// <param name="question">The question.</param>
/// <returns>
/// <c>true</c> is user answered yes; otherwise <c>false</c>.
/// </returns>
public bool AskYesNoQuestion(string title, string question)
{
TaskDialog dialog = new TaskDialog
{
Caption = title,
Instruction = title,
Content = question,
MainIcon = TaskDialogStandardIcon.Warning,
StandardButtons = TaskDialogStandardButtons.YesNo
};
TaskDialogResult result = dialog.Show();
return result.StandardButtonClicked == TaskDialogStandardButton.Yes;
}
示例15: ShowMessage
/// <summary>
/// Ask User
/// </summary>
/// <returns></returns>
internal static bool ShowMessage()
{
using (TaskDialog td = new TaskDialog("Explanation"))
{
td.TitleAutoPrefix = false;
td.MainInstruction = "Update 'CurveOrientation' Parameters";
td.MainContent += "This command requires that an instance text parameter named 'CurveOrientation' exist on all elements of the target category.\n\n";
td.MainContent += "A text string of HORIZONTAL, VERTICAL, or SLOPED will then get placed into each element's 'CurveOrientation' parameter for the primary purpose of clash detection filtering in an external program.";
td.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Update 'CurveOrientation' Parameters");
td.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Cancel and Do Nothing");
if (td.Show() == TaskDialogResult.CommandLink1)
return true;
else
return false;
}
}