private void showBtn_Click(object sender, System.EventArgs e) { NTaskDialog dlg = new NTaskDialog(); dlg.Title = "Q2 2007 Radio Buttons Support"; dlg.Content.Text = "<font size='12' face='Trebuchet MS'>Task Dialog <b>Radio Buttons</b> example</font>"; dlg.Content.Image = NSystemImages.Information; dlg.Content.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; dlg.Content.ImageSize = new NSize(32, 32); dlg.PreferredWidth = 300; if (m_arrButtons.Count > 0) { NRadioBoxElement[] buttons = new NRadioBoxElement[m_arrButtons.Count]; m_arrButtons.CopyTo(buttons); dlg.RadioButtons = buttons; } dlg.Show(); NRadioBoxElement box = dlg.CheckedRadioButton; if (box != null) { checkedButtonLabel.Text = box.Text; } else { checkedButtonLabel.Text = "None"; } dlg.RadioButtons = null; dlg.Dispose(); }
private void OnAllFeaturesButtonClick(NEventArgs arg) { NTaskDialog taskDialog = NTaskDialog.Create(OwnerWindow); taskDialog.Title = "Task Dialog"; // Add header and content taskDialog.Header = new NTaskDialogHeader(ENMessageBoxIcon.Information, "This is the header."); taskDialog.Content = new NLabel("This is the content."); // Add some radio buttons and custom buttons taskDialog.RadioButtonGroup = new NTaskDialogRadioButtonGroup("Radio Button 1", "Radio Button 2", "Radio Button 3"); taskDialog.CustomButtons = new NTaskDialogCustomButtonCollection("Custom Button 1", "Custom Button 2", "Custom Button 3"); // Set the common buttons taskDialog.Buttons = ENTaskDialogButton.OK | ENTaskDialogButton.Cancel; // Add a verification check box and a footer taskDialog.VerificationCheckBox = new NCheckBox("This is the verification check box."); taskDialog.Footer = new NLabel("This is the footer."); // Subscribe to the Closed event and open the task dialog taskDialog.Closed += OnTaskDialogClosed; taskDialog.Open(); }
private void standardMessageBoxBtn_Click(object sender, System.EventArgs e) { NTaskDialog dlg = CreateDefaultDialog(); //dlg.PredefinedButtons = TaskDialogButtons.Ok; dlg.PreferredWidth = 360; dlg.Show(); }
internal NTaskDialog CreateDefaultDialog() { NTaskDialog dlg = new NTaskDialog(); dlg.Title = "Nevron User Interface Q4 2006"; dlg.Content.Text = "Download of Nevron .NET Vision Q4 2006 is complete!"; dlg.Content.Image = NSystemImages.Information; dlg.Content.ImageSize = new NSize(32, 32); return(dlg); }
private void OnRadioButtonsButtonClick(NEventArgs arg) { NTaskDialog taskDialog = NTaskDialog.Create(OwnerWindow); taskDialog.Title = "Task Dialog"; taskDialog.Header = new NTaskDialogHeader(ENMessageBoxIcon.Information, "This is a task dialog with radio buttons."); taskDialog.RadioButtonGroup = new NTaskDialogRadioButtonGroup("Radio Button 1", "Radio Button 2"); taskDialog.Buttons = ENTaskDialogButton.OK; // Subscribe to the Closed event and open the task dialog taskDialog.Closed += OnTaskDialogClosed; taskDialog.Open(); }
private void OnCustomButtonsButtonClick(NEventArgs arg) { NTaskDialog taskDialog = NTaskDialog.Create(OwnerWindow); taskDialog.Title = "Task Dialog"; taskDialog.Header = new NTaskDialogHeader(ENMessageBoxIcon.Information, "This is a task dialog with custom buttons."); taskDialog.CustomButtons = new NTaskDialogCustomButtonCollection("Custom Button 1", "Custom Button 2", "Custom Button 3"); // Subscribe to the Closed event and open the task dialog taskDialog.Closed += OnTaskDialogClosed; taskDialog.Open(); }
private void OnVerificationButtonClick(NEventArgs arg) { NTaskDialog taskDialog = NTaskDialog.Create(OwnerWindow); taskDialog.Title = "Task Dialog"; taskDialog.Header = new NTaskDialogHeader(ENMessageBoxIcon.Information, "This is the header."); taskDialog.Content = new NLabel("This is the content."); taskDialog.VerificationCheckBox = new NCheckBox("This is the verification check box."); taskDialog.Buttons = ENTaskDialogButton.OK | ENTaskDialogButton.Cancel; // Subscribe to the Closed event and open the task dialog taskDialog.Closed += OnTaskDialogClosed; taskDialog.Open(); }
private void OnTaskDialogClosed(NEventArgs arg) { NTaskDialog taskDialog = (NTaskDialog)arg.TargetNode; int radioButtonIndex = taskDialog.RadioButtonGroup != null ? taskDialog.RadioButtonGroup.SelectedIndex : -1; bool verificationChecked = taskDialog.VerificationCheckBox != null ? taskDialog.VerificationCheckBox.Checked : false; StringBuilder sb = new StringBuilder(); sb.AppendLine("Task result: " + taskDialog.TaskResult.ToString()); sb.AppendLine("Radio button: " + radioButtonIndex.ToString()); sb.AppendLine("Custom button: " + taskDialog.CustomButtonIndex.ToString()); sb.AppendLine("Verification: " + verificationChecked.ToString()); m_EventsLog.LogEvent(sb.ToString()); }
private void OnCallBack(object sender, NTaskDialogEventArgs e) { switch (e.Notification) { case TaskDialogNotification.ButtonClick: int id = ((NPushButtonElement)sender).Id; if (id == 100) //cancel button; leave default implementation { break; } switch (id) { case 101: //pause button m_bPaused = true; break; case 102: //resume button m_bPaused = false; break; } //prevent the default implementation of the click which will close the dialog e.Cancel = true; break; case TaskDialogNotification.TimerTick: if (m_bPaused) { break; } NTaskDialog dlg = e.Dialog; NProgressBarElement progress = dlg.ProgressBar; progress.Value++; if (progress.Value == progress.Maximum) { if (dlg.Verification.CheckState == CheckState.Checked) { e.Form.Close(); } } break; } }
private void OnMessageBoxLikeButtonClick(NEventArgs arg) { NTaskDialog taskDialog = NTaskDialog.Create(OwnerWindow); taskDialog.Title = "Task Dialog"; taskDialog.Header = new NTaskDialogHeader(ENMessageBoxIcon.Question, "Do you want to save the changes?"); taskDialog.Buttons = ENTaskDialogButton.Yes | ENTaskDialogButton.No | ENTaskDialogButton.Cancel; // Change the texts of the Yes and No buttons NStackPanel stack = taskDialog.ButtonStrip.GetPredefinedButtonsStack(); NLabel label = (NLabel)stack[0].GetFirstDescendant(NLabel.NLabelSchema); label.Text = "Save"; label = (NLabel)stack[1].GetFirstDescendant(NLabel.NLabelSchema); label.Text = "Don't Save"; // Subscribe to the Closed event and open the task dialog taskDialog.Closed += OnTaskDialogClosed; taskDialog.Open(); }
private void OnAdvancedCustomButtonsButtonClick(NEventArgs arg) { NTaskDialog taskDialog = NTaskDialog.Create(OwnerWindow); taskDialog.Title = "Task Dialog"; taskDialog.Header = new NTaskDialogHeader(ENMessageBoxIcon.Information, "This is a task dialog with custom buttons."); taskDialog.Content = new NLabel("These custom buttons contain a symbol/image, a title and a description."); // Create some custom buttons taskDialog.CustomButtons = new NTaskDialogCustomButtonCollection(); taskDialog.CustomButtons.Add(new NTaskDialogCustomButton("Title Only")); taskDialog.CustomButtons.Add(new NTaskDialogCustomButton("Title and Description", "This button has a title and a description.")); taskDialog.CustomButtons.Add(new NTaskDialogCustomButton(NTaskDialogCustomButton.CreateDefaultSymbol(), "Symbol, Title, and Description", "This button has a symbol, a title and a description.")); taskDialog.CustomButtons.Add(new NTaskDialogCustomButton(NResources.Image__16x16_Mail_png, "Image, Title and Description", "This button has an icon, a title and a description.")); // Subscribe to the Closed event and open the task dialog taskDialog.Closed += OnTaskDialogClosed; taskDialog.Open(); }
private void customizedMessageBoxBtn_Click(object sender, System.EventArgs e) { NTaskDialog dlg = new NTaskDialog(); dlg.PreferredWidth = 400; dlg.ProgressType = TaskDialogProgressType.Marguee; dlg.MarqueeProgress.Start(); dlg.Title = "Nevron User Interface Q4 2006"; dlg.Content.Style.TextStrokeStyle = new NStrokeStyle(1, Color.Brown); dlg.Content.Style.TextFillStyle = new NColorFillStyle(Color.Wheat); dlg.Content.Style.TextSmoothingMode = SmoothingMode.AntiAlias; dlg.Content.Style.FontInfo = new NThemeFontInfo("Trebuchet MS", 22f, FontStyleEx.Bold | FontStyleEx.Italic); dlg.Content.Text = "Downloading Nevron .NET Vision Q4 2006..."; NPushButtonElement[] customButtons = new NPushButtonElement[2]; NPushButtonElement btn; btn = new NPushButtonElement(); btn.Text = "<b>Cancel Download</b>"; btn.Image = NSystemImages.Error; btn.ImageTextRelation = ImageTextRelation.ImageAboveText; btn.ImageSize = new NSize(32, 32); btn.Id = 0; customButtons[0] = btn; btn = new NPushButtonElement(); btn.Text = "<b>Pause Download</b>"; btn.Image = NSystemImages.Exclamation; btn.ImageTextRelation = ImageTextRelation.ImageAboveText; btn.ImageSize = new NSize(32, 32); btn.Id = 1; customButtons[1] = btn; dlg.UserButtons = customButtons; dlg.DefaultButtonId = 2; dlg.Show(); }
private void progressDialogBtn_Click(object sender, System.EventArgs e) { NTaskDialog dlg = new NTaskDialog(); dlg.PreferredWidth = 400; dlg.ProgressType = TaskDialogProgressType.Standard; dlg.Title = "Nevron User Interface Q4 2006"; dlg.Content.Style.FontInfo = new NThemeFontInfo("Tahoma", 10f, FontStyleEx.Regular); dlg.Content.Text = "Downloading Nevron .NET Vision Q4 2006..."; dlg.Content.Image = NSystemImages.Information; dlg.Content.ImageSize = new NSize(32, 32); dlg.ProgressType = TaskDialogProgressType.Standard; dlg.EnableTimer = true; dlg.Verification.Text = "Close this dialog when download is complete"; dlg.Notify += m_CallBack; //inint buttons NPushButtonElement cancelBtn = new NPushButtonElement(); cancelBtn.Text = "Cancel"; cancelBtn.Id = 100; NPushButtonElement pauseBtn = new NPushButtonElement(); pauseBtn.Text = "Pause"; pauseBtn.Id = 101; NPushButtonElement resumeBtn = new NPushButtonElement(); resumeBtn.Text = "Resume"; resumeBtn.Id = 102; dlg.UserButtons = new NPushButtonElement[] { cancelBtn, pauseBtn, resumeBtn }; //the defaulted button is "Pause" dlg.DefaultButtonId = 101; dlg.Show(); }
public override void Initialize() { base.Initialize(); NImageAndTextItem item; string text; Type t = GetType(); string path = "Nevron.Examples.UI.WinForm.Resources.Images.TaskDialog"; m_TaskDialog = new NTaskDialog(); m_TaskDialog.PreferredWidth = 350; m_TaskDialog.PredefinedButtons = TaskDialogButtons.Yes | TaskDialogButtons.No | TaskDialogButtons.Cancel; m_TaskDialog.Title = "Nevron User Interface for .NET"; //customize header item = m_TaskDialog.Content; item.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; item.TreatAsOneEntity = false; item.ImageAlign = ContentAlignment.BottomRight; item.TextAlign = ContentAlignment.TopLeft; item.ImageTextRelation = ImageTextRelation.None; item.ImageAlpha = 0.5f; item.Image = NResourceHelper.BitmapFromResource(t, "computer_48_hot.png", path); item.ImageSize = new NSize(48, 48); item.Style.TextFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.Red, 8); item.Style.TextShadowStyle = new NShadowStyle(ShadowType.LinearBlur, Color.Gray, 1, 1, 1F, 1); text = "<b><font size='10' face='Verdana' color='navy'>Nevron User Interface for .NET Q4 2006 is available!</font></b>"; text += "<br/><br/>Following are the new features:"; text += "<br/><br/><u>Chart for .NET:</u><br/><br/>"; text += "<ul liststyletype='decimal'>"; text += "<li>Brand new axis model.</li>"; text += "<li>Greatly improved date-time support.</li>"; text += "<li>Date-time scrolling.</li>"; text += "</ul>"; text += "<br/><u>User Interface for .NET:</u><br/><br/>"; text += "<ul liststyletype='decimal'>"; text += "<li>Extended DateTimePicker.</li>"; text += "<li>Vista-like TaskDialog.</li>"; text += "<li>Hyper-links per element basis.</li>"; text += "</ul>"; text += "<br/><font size='10' color='black'>Download the new version now?</font>"; item.Text = text; item = m_TaskDialog.Footer; item.HyperLinkClick += new NHyperLinkEventHandler(OnFooterHyperLinkClick); Icon icon = SystemIcons.Information; NSize imageSize = new NSize(icon.Width, icon.Height); item.Image = NSystemImages.Information; item.ImageSize = imageSize; text = "For more information visit <a href='http://www.nevron.com/News.aspx?content=News'>www.nevron.com</a>"; item.Text = text; item = m_TaskDialog.Verification; item.Text = "In future download new versions automatically"; propertyGrid.SelectedObject = m_TaskDialog; }
private void vistaLikeNotification_Click(object sender, System.EventArgs e) { NTaskDialog dlg = new NTaskDialog(); dlg.Title = "Copy File"; dlg.PreferredWidth = 480; dlg.PredefinedButtons = TaskDialogButtons.Cancel; NThemeFontInfo fi = new NThemeFontInfo("Tahoma", 9, FontStyleEx.Regular); NLabelElement label = dlg.Content; label.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; label.Text = "<font color='navy' size='11' face='Tahoma'>There is already a file with the same name in this location.</font><br/><br/>What would you like to do:"; NPushButtonElement[] largeButtons = new NPushButtonElement[3]; NPushButtonElement button; string text; button = new NPushButtonElement(); button.Id = 100; button.TreatAsOneEntity = false; button.ImageAlign = ContentAlignment.TopLeft; button.TextAlign = ContentAlignment.TopLeft; button.Image = NSystemImages.Question; button.ImageSize = new NSize(32, 32); button.ContentAlign = ContentAlignment.MiddleLeft; button.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; button.Style.FontInfo = fi; text = "<font color='navy' size='12'>Copy and replace</font><br/><font color='navy'>Replace the file in the destination folder with the file you are copying:</font><br/>"; text += "<b>NTaskDialog.cs</b><br/>"; text += @"<font color='navy'>NTaskDialog (C:\Projects\UI\WinForm\Controls\Forms\TaskDialog)</font>"; text += "<br/>Size: 14 KB<br/>"; text += "Date Modified: 03/03/2007 10:00 AM (Newer)"; button.Text = text; largeButtons[0] = button; button = new NPushButtonElement(); button.Id = 101; button.TreatAsOneEntity = false; button.ImageAlign = ContentAlignment.TopLeft; button.TextAlign = ContentAlignment.TopLeft; button.Image = NSystemImages.Question; button.ImageSize = new NSize(32, 32); button.ContentAlign = ContentAlignment.MiddleLeft; button.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; button.Style.FontInfo = fi; text = "<font color='navy' size='12'>Don't Copy</font><br/><font color='navy'>No files will be changed. Leave this file in the destination folder:</font><br/>"; text += "<b>NTaskDialog.cs</b><br/>"; text += @"<font color='navy'>NTaskDialog (C:\OldProjects\UI\WinForm\Controls\Forms\TaskDialog)</font>"; text += "<br/>Size: 12 KB (Smaller)<br/>"; text += "Date Modified: 03/03/2007 09:00 AM"; button.Text = text; largeButtons[1] = button; button = new NPushButtonElement(); button.Id = 102; button.TreatAsOneEntity = false; button.ImageAlign = ContentAlignment.TopLeft; button.TextAlign = ContentAlignment.TopLeft; button.Image = NSystemImages.Question; button.ImageSize = new NSize(32, 32); button.ContentAlign = ContentAlignment.MiddleLeft; button.Style.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; button.Style.FontInfo = fi; text = "<font color='navy' size='12'>Copy, but keep both files</font><br/><font color='navy'>The file you are copying will be renamed \"NTaskDialog (2).cs\"</font>"; button.Text = text; largeButtons[2] = button; dlg.DefaultButtonId = 100; dlg.LargeUserButtons = largeButtons; dlg.Show(); }