本文整理汇总了C#中Microsoft.WindowsAPICodePack.Dialogs.TaskDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# TaskDialog.ShowDialog方法的具体用法?C# TaskDialog.ShowDialog怎么用?C# TaskDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAPICodePack.Dialogs.TaskDialog
的用法示例。
在下文中一共展示了TaskDialog.ShowDialog方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: c_Move_Click
private void c_Move_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
string s = "Are you sure you want to move the selected " + ((listView1.SelectedItems.Count > 1) ? "items?" : "item?");
DialogResult dr = DialogResult.No;
if (Aero)
{
TaskDialog td = new TaskDialog();
td.Caption = "Confirm Move";
td.InstructionText = s;
td.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
if (td.ShowDialog(this.Handle) == TaskDialogResult.Yes)
{
dr = DialogResult.Yes;
}
}
else
{
dr = MessageBox.Show("Confirm Move", s, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
}
if (dr == DialogResult.Yes)
{
Forms.FolderSelector fs = new Party_Buffalo.Forms.FolderSelector(treeView1, treeView1.Nodes[0].Nodes.Find(treeView1.SelectedNode.RealPath().Split('\\')[0], false)[0]);
if (fs.ShowDialog() == DialogResult.OK)
{
string SelectedPath = fs.SelectedPath;
List<CLKsFATXLib.Structs.WriteResult> List = new List<CLKsFATXLib.Structs.WriteResult>();
foreach (ListViewItem li in listView1.SelectedItems)
{
Entry Entry = (Entry)li.Tag;
CLKsFATXLib.Structs.WriteResult wr = Entry.Move(SelectedPath);
if (wr.CouldNotWrite)
{
List.Add(wr);
}
}
if (List.Count != 0)
{
string UnableToWrite = "Some of the entries could not be written";
string BadEntries = "";
for (int i = 0; i < List.Count; i++)
{
BadEntries += List[i].AttemptedEntryToMove.FullPath;
if (i != List.Count - 1)
{
BadEntries += "\r\n";
}
}
if (Aero)
{
TaskDialog td = new TaskDialog();
td.Caption = "Moving Error";
td.InstructionText = UnableToWrite;
td.Text = "Press the details button for a list of entries that could not be moved";
td.DetailsExpandedText = BadEntries;
td.StandardButtons = TaskDialogStandardButtons.Ok;
td.ShowDialog(this.Handle);
}
else
{
MessageBox.Show("Moving Error", UnableToWrite + "\r\n\r\n" + BadEntries, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}
}
}
示例2: c_Delete_Click
private void c_Delete_Click(object sender, EventArgs e)
{
// String.format is a little redundant here...
DialogResult dr = DialogResult.No;
if (!Aero)
{
dr = MessageBox.Show(string.Format("Are you sure you want to delete the selected{0}?", (listView1.SelectedItems.Count > 1) ? " " + listView1.SelectedItems.Count.ToString() + " items" : " item"), "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
}
else
{
TaskDialog td = new TaskDialog();
td.Caption = "Confirm Deletion";
td.InstructionText = "Confirm Deletion";
td.Text = string.Format("Are you sure you want to delete the selected{0}?", (listView1.SelectedItems.Count > 1) ? " " + listView1.SelectedItems.Count.ToString() + " items" : " item");
td.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
if (td.ShowDialog(this.Handle) == TaskDialogResult.Yes)
{
dr = DialogResult.Yes;
}
}
if (dr == DialogResult.Yes)
{
List<Entry> items = new List<Entry>();
foreach (ListViewItem li in listView1.SelectedItems)
{
items.Add((Entry)li.Tag);
}
Forms.EntryAction ea = new Party_Buffalo.Forms.EntryAction(items.ToArray(), Party_Buffalo.Forms.EntryAction.Method.Delete, "");
ea.ShowDialog();
}
}
示例3: t_NewFolder_Click
private void t_NewFolder_Click(object sender, EventArgs e)
{
try
{
((Folder)rightClickedNode.Tag).CreateNewFolder(GetNewFolderName((Folder)rightClickedNode.Tag));
}
catch (Exception x)
{
if (!Aero)
{
MessageBox.Show("An exception was thrown: " + x.Message + "\r\n\r\nIf this appears to be a bug, press CTRL + C to copy the stack trace, then please email it to me at [email protected]:\r\n" + x.StackTrace);
}
else
{
TaskDialog td = new TaskDialog();
td.Caption = "Unhandled Exception";
td.InstructionText = "An Unhandled Exception was Thrown";
td.Text = string.Format("An exception was thrown: {0}\r\n\r\nIf this appears to be a bug, please email me at [email protected] with the details below", x.Message);
td.DetailsCollapsedLabel = "Details";
td.DetailsExpandedLabel = "Details";
td.DetailsExpandedText = x.StackTrace;
TaskDialogButton Copy = new TaskDialogButton("Copy", "Copy Details to Clipboard");
Copy.Click += (o, f) => { Clipboard.SetDataObject(x.Message + "\r\n\r\n" + x.StackTrace, true, 10, 200); };
TaskDialogButton Close = new TaskDialogButton("Close", "Close");
Close.Click += (o, f) => { td.Close(); };
td.Controls.Add(Copy);
td.Controls.Add(Close);
td.ShowDialog(this.Handle);
}
}
}
示例4: t_Delete_Click
private void t_Delete_Click(object sender, EventArgs e)
{
DialogResult dr = DialogResult.No;
if (!Aero)
{
dr = MessageBox.Show("Are you sure you want to delete the selected folder?", "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
}
else
{
TaskDialog td = new TaskDialog();
td.Caption = "Confirm Deletion";
td.InstructionText = "Confirm Deletion";
td.Text = string.Format("Are you sure you want to delete folder \"{0}\"?", rightClickedNode.Name);
td.StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
if (td.ShowDialog(this.Handle) == TaskDialogResult.Yes)
{
dr = DialogResult.Yes;
}
}
if (dr == DialogResult.Yes)
{
List<Entry> items = new List<Entry>();
items.Add((Entry)rightClickedNode.Tag);
if (rightClickedNode == treeView1.SelectedNode)
{
foreach (ListViewItem li in listView1.SelectedItems)
{
items.Add((Entry)li.Tag);
}
}
Forms.EntryAction ea = new Party_Buffalo.Forms.EntryAction(items.ToArray(), Party_Buffalo.Forms.EntryAction.Method.Delete, "");
ea.ShowDialog();
// Remove those treeview items
foreach (Entry en in items)
{
if (en.IsFolder)
{
try
{
treeView1.SelectedNode.Nodes.Find(en.Name, false)[0].Remove();
}
catch { }
}
if (rightClickedNode == treeView1.SelectedNode)
{
listView1.Items.Find(en.Name, false)[0].Remove();
}
}
((Folder)rightClickedNode.Tag).Reload();
}
}
示例5: menuItem9_Click
private void menuItem9_Click(object sender, EventArgs e)
{
DialogResult dr = DialogResult.No;
string Path = "";
if (Aero)
{
CommonOpenFileDialog ofd = new CommonOpenFileDialog();
ofd.IsFolderPicker = true;
ofd.Multiselect = false;
if (ofd.ShowDialog() == CommonFileDialogResult.Ok)
{
dr = DialogResult.OK;
Path = ofd.FileName;
}
}
else
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
Path = fbd.SelectedPath;
}
}
if (dr == DialogResult.OK)
{
List<string> filePaths = new List<string>();
for (int i = 0; i < 10000; i++)
{
string extra = "";
if (i < 10)
{
extra = "000";
}
else if (i < 100)
{
extra = "00";
}
else if (i < 1000)
{
extra = "0";
}
if (System.IO.File.Exists(Path + "\\Data" + extra + i.ToString()))
{
filePaths.Add(Path + "\\Data" + extra + i.ToString());
}
else { break; }
}
Drive d = new Drive(filePaths.ToArray());
if (filePaths.Count < 3 || !d.IsFATXDrive())
{
if (Aero)
{
Microsoft.WindowsAPICodePack.Dialogs.TaskDialog td = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialog();
td.Caption = "Files not valid";
td.Text = "The selected path doesn't contain a valid USB backup/dump.";
td.InstructionText = "Files Not Valid";
td.Icon = TaskDialogStandardIcon.Error;
td.ShowDialog(this.Handle);
}
else
{
MessageBox.Show("The selected path doesn't contain a valid USB backup/dump.", "Files Not Valid", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
if (Drive != null)
{
Drive.Close();
}
Drive = d;
LoadDrive();
}
}
}
示例6: ExceptionHandler
void ExceptionHandler(Exception x)
{
if (!Aero)
{
MessageBox.Show("An exception was thrown: " + x.Message + "\r\n\r\nPress CTRL + C to copy the stack trace:\r\n" + x.StackTrace);
}
else
{
tm.SetProgressState(TaskbarProgressBarState.Error);
this.Invoke((MethodInvoker)delegate
{
TaskDialog td = new TaskDialog();
td.Caption = "Unhandled Exception";
td.InstructionText = "An Unhandled Exception was Thrown";
td.Text = string.Format("An exception was thrown: {0}\r\n\r\nIf this appears to be a bug, please email me at [email protected] with the details below", x.Message);
td.DetailsCollapsedLabel = "Details";
td.DetailsExpandedLabel = "Details";
td.DetailsExpandedText = x.StackTrace;
TaskDialogButton Copy = new TaskDialogButton("Copy", "Copy Details to Clipboard");
Copy.Click += (o, f) => { this.Invoke((MethodInvoker)delegate { Clipboard.SetDataObject(x.Message + "\r\n\r\n" + x.StackTrace, true, 10, 200); }); };
TaskDialogButton Close = new TaskDialogButton("Close", "Close");
Close.Click += (o, f) => { td.Close(); };
td.Controls.Add(Copy);
td.Controls.Add(Close);
td.ShowDialog(this.Handle);
});
}
}