private void OnShowDialogButtonClick(NEventArgs arg1) { NStackPanel stack = new NStackPanel(); stack.Margins = new NMargins(10); stack.VerticalSpacing = 10; NButton openButton = new NButton("Open File..."); openButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center; openButton.Click += new Function <NEventArgs>(OnOpenButtonClick); stack.Add(openButton); NButton saveButton = new NButton("Save to File..."); saveButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center; saveButton.Click += new Function <NEventArgs>(OnSaveButtonClick); stack.Add(saveButton); NButtonStrip closeButtonStrip = new NButtonStrip(); closeButtonStrip.InitCloseButtonStrip(); stack.Add(closeButtonStrip); // create a dialog that is owned by this widget window NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(); dialog.SetupDialogWindow("Show File Dialogs", false); dialog.Content = stack; dialog.Open(); }
private void OnViewResponseHeadersButtonClick(NEventArgs args) { // get the response form the button tag (see UpdateRequestListBoxItem) and display its headers object[] array = (object[])args.TargetNode.Tag; NHttpRequest request = (NHttpRequest)array[0]; NHttpResponse response = (NHttpResponse)array[1]; // create a top level window, setup as a dialog NTopLevelWindow window = NApplication.CreateTopLevelWindow(); window.SetupDialogWindow(request.Uri.ToString(), true); // create a list box for the headers NListBox listBox = new NListBox(); window.Content = listBox; // fill with header fields INIterator <NHttpHeaderField> it = response.HeaderFields.GetIterator(); while (it.MoveNext()) { listBox.Items.Add(new NListBoxItem(it.Current.ToString())); } // open the window window.Open(); }
private void OnShowDesignerButtonClicked(NEventArgs args) { NEditor editor = NDesigner.GetDesigner(m_ComboBox).CreateInstanceEditor(m_ComboBox); NEditorWindow window = NApplication.CreateTopLevelWindow <NEditorWindow>(); window.Editor = editor; window.Open(); }
private void OnAddAttributeButtonClick(NEventArgs arg) { NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(); dialog.SetupDialogWindow("Enter attribute's name and value", false); NTableFlowPanel table = new NTableFlowPanel(); table.Direction = ENHVDirection.LeftToRight; table.ColFillMode = ENStackFillMode.Last; table.ColFitMode = ENStackFitMode.Last; table.MaxOrdinal = 2; NLabel nameLabel = new NLabel("Name:"); table.Add(nameLabel); NTextBox nameTextBox = new NTextBox(); table.Add(nameTextBox); NLabel valueLabel = new NLabel("Value:"); table.Add(valueLabel); NTextBox valueTextBox = new NTextBox(); table.Add(valueTextBox); table.Add(new NWidget()); NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); table.Add(buttonStrip); dialog.Content = table; dialog.Opened += delegate(NEventArgs args) { nameTextBox.Focus(); }; dialog.Closed += delegate(NEventArgs args) { if (dialog.Result == ENWindowResult.OK) { NElementInfo elementInfo = (NElementInfo)m_TreeView.SelectedItem.Tag; elementInfo.Attributes.Set(nameTextBox.Text, valueTextBox.Text); UpdateTreeViewItemText(m_TreeView.SelectedItem); if (m_RemoveAttributeButton.Enabled == false) { m_RemoveAttributeButton.Enabled = true; } } }; dialog.Open(); }
private void OnRemoveAttributeButtonClick(NEventArgs arg) { NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(); dialog.SetupDialogWindow("Select an Attribute to Remove", false); NListBox listBox = new NListBox(); NElementInfo elementInfo = (NElementInfo)m_TreeView.SelectedItem.Tag; INIterator <NKeyValuePair <string, string> > iter = elementInfo.Attributes.GetIterator(); while (iter.MoveNext()) { listBox.Items.Add(new NListBoxItem(iter.Current.Key)); } NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); NPairBox pairBox = new NPairBox(listBox, buttonStrip, ENPairBoxRelation.Box1AboveBox2); pairBox.Spacing = NDesign.VerticalSpacing; dialog.Content = pairBox; dialog.Opened += delegate(NEventArgs args) { listBox.Focus(); }; dialog.Closed += delegate(NEventArgs args) { if (dialog.Result == ENWindowResult.OK) { // Remove the selected attribute NListBoxItem selectedItem = listBox.Selection.FirstSelected; if (selectedItem != null) { string name = ((NLabel)selectedItem.Content).Text; elementInfo.Attributes.Remove(name); UpdateTreeViewItemText(m_TreeView.SelectedItem); if (elementInfo.Attributes.Count == 0) { m_RemoveAttributeButton.Enabled = false; } } } }; dialog.Open(); }
private void OnMergeAndSaveToFolderButtonClick(NEventArgs arg) { NTextBox textBox = new NTextBox(); NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); NPairBox pairBox = new NPairBox(textBox, buttonStrip, ENPairBoxRelation.Box1AboveBox2); NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(); dialog.SetupDialogWindow("Enter Folder Path", false); dialog.Content = pairBox; dialog.Closed += OnEnterFolderDialogClosed; dialog.Open(); }
private void OnButtonClick(NEventArgs args) { NButton button = args.TargetNode as NButton; if (button == null) { return; } NDesigner designer = (NDesigner)button.Tag; NEditor editor = designer.CreateInstanceEditor(m_Node); NEditorWindow window = NApplication.CreateTopLevelWindow <NEditorWindow>(); window.Editor = editor; window.Modal = false; window.Open(); }
/// <summary> /// Creates and opens a child window of the specified owner window. /// </summary> /// <param name="ownerWindow"></param> private void OpenChildWindow(NWindow ownerWindow) { // Create the window NTopLevelWindow window = NApplication.CreateTopLevelWindow(ownerWindow); window.Title = "Window " + m_ChildWindowIndex++; window.PreferredSize = WindowSize; // subscribe for window state events window.Opened += new Function <NEventArgs>(OnWindowStateEvent); window.Activated += new Function <NEventArgs>(OnWindowStateEvent); window.Deactivated += new Function <NEventArgs>(OnWindowStateEvent); window.Closing += new Function <NEventArgs>(OnWindowStateEvent); window.Closed += new Function <NEventArgs>(OnWindowStateEvent); // subscribe for window UI events window.GotFocus += new Function <NFocusChangeEventArgs>(OnWindowUIEvent); window.LostFocus += new Function <NFocusChangeEventArgs>(OnWindowUIEvent); // Create its content NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.First; stack.FitMode = ENStackFitMode.First; string ownerName = ownerWindow is NTopLevelWindow ? ((NTopLevelWindow)ownerWindow).Title : "Examples Window"; NLabel label = new NLabel("Child Of \"" + ownerName + "\""); label.HorizontalPlacement = ENHorizontalPlacement.Center; label.VerticalPlacement = ENVerticalPlacement.Center; stack.Add(label); stack.Add(CreateOpenChildWindowButton()); window.Content = stack; // Open the window AddTreeViewItemForWindow(window); window.Open(); if (ownerWindow is NTopLevelWindow) { window.X = ownerWindow.X + 25; window.Y = ownerWindow.Y + 25; } }
/// <summary> /// Creates a custom appointment edit dialog. /// </summary> /// <returns></returns> public override NTopLevelWindow CreateEditDialog() { NSchedule schedule = (NSchedule)GetFirstAncestor(NSchedule.NScheduleSchema); NWindow window = schedule != null ? schedule.OwnerWindow : null; // Create a dialog window NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(window)); dialog.SetupDialogWindow("Appointment with Image Editor", true); NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // Add an image box with the image NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(Image)); stack.Add(imageBox); // Add property editors for some of the appointment properties NDesigner designer = NDesigner.GetDesigner(this); NList <NPropertyEditor> editors = designer.CreatePropertyEditors(this, SubjectProperty, StartProperty, EndProperty); for (int i = 0; i < editors.Count; i++) { stack.Add(editors[i]); } // Add a button strip with OK and Cancel buttons NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); stack.Add(buttonStrip); dialog.Content = new NUniSizeBoxGroup(stack); return(dialog); }
private void OnAddChildItemButtonClick(NEventArgs arg) { NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(OwnerWindow)); dialog.SetupDialogWindow("Enter element's name", false); NTextBox textBox = new NTextBox(); NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); NPairBox pairBox = new NPairBox(textBox, buttonStrip, ENPairBoxRelation.Box1AboveBox2); pairBox.Spacing = NDesign.VerticalSpacing; dialog.Content = pairBox; dialog.Opened += delegate(NEventArgs args) { textBox.Focus(); }; dialog.Closed += delegate(NEventArgs args) { if (dialog.Result == ENWindowResult.OK) { // Add an item with the specified name m_TreeView.SelectedItem.Items.Add(CreateTreeViewItem(textBox.Text)); m_TreeView.SelectedItem.Expanded = true; if (m_SerializeButton.Enabled == false) { m_SerializeButton.Enabled = true; } } }; dialog.Open(); }
static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // install Nevron Open Vision for Windows Forms NNovApplicationInstaller.Install( NTextModule.Instance, NChartModule.Instance, NDiagramModule.Instance, NScheduleModule.Instance, NGridModule.Instance, NBarcodeModule.Instance); // show the main form bool startWithNovWindow = false; if (startWithNovWindow) { // create a NOV top level window NTopLevelWindow window = NApplication.CreateTopLevelWindow(); window.BackgroundFill = new NColorFill(NColor.White); window.Content = new NExamplesContent(); window.Closed += OnWindowClosed; window.Title = "Nevron Open Vision Examples for Windows Forms"; window.AllowXResize = true; window.AllowYResize = true; window.ShowInTaskbar = true; window.Modal = true; window.PreferredSize = new NSize(500, 500); window.StartPosition = ENWindowStartPosition.CenterScreen; window.Open(); // run the application ApplicationContext context = new ApplicationContext(); Application.Run(context); } else { // create a WinForms form Form form = new Form(); // set form icon using (Stream stream = typeof(Program).Assembly.GetManifestResourceStream("Nevron.Nov.Examples.WinForm.Resources.NevronOpenVision.ico")) { Icon icon = new Icon(stream); form.Icon = icon; } // set form title and state form.Text = "Nevron Open Vision Examples for Windows Forms"; form.WindowState = FormWindowState.Maximized; // place a NOV WinForms Control that contains an NExampleContent widget NNovWidgetHost <NExamplesContent> host = new NNovWidgetHost <NExamplesContent>(); host.Dock = DockStyle.Fill; form.Controls.Add(host); // run the form Application.Run(form); } } catch (Exception ex) { NTrace.WriteException("Exception in Main", ex); } }