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 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 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(); }
/// <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(); }