/// <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);
            }
Beispiel #2
0
        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();
        }