public override UserControlBase[] ToolsWindows()
        {
            UserControlBase[] toolsWindows = new UserControlBase[1];
            toolsWindows[0] = regExPropertys;

            return toolsWindows;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);
                if (ShoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.ETO)
                {
                    lbOrderPref.Text = GetLocalResourceObject("ETOOrderPreferencesHeader").ToString();
                }
                else
                {
                    lbOrderPref.Text = GetLocalResourceObject("RSOOrderPreferencesHeader").ToString();
                }
            }

            var paymentsControl =
                LoadControl(HLConfigManager.Configurations.PaymentsConfiguration.PaymentInfoControl);

            ucPaymentInfoControl = paymentsControl as UserControlBase;
            phPaymentInfoControl.Controls.Add(paymentsControl);

            if (HLConfigManager.Configurations.PaymentsConfiguration.UseCardRegistry)
            {
                lbtAddPaymentInformation.Visible = false;
            }

            dvSavedPaymentInformation.Visible = HLConfigManager.Configurations.PaymentsConfiguration.AllowSavedCards;
            dvSavedShippingAddress.Visible    = HLConfigManager.Configurations.DOConfiguration.AllowShipping;
            processShippingAddress();
            processPaymentInformation();
            processPickupLocation();
            processPUFromCourierLocation();
            (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid col-sm-10 gdo-nav-mid-op");
        }
        public static bool?ShowDialog(
            string windowTitle,
            UserControlBase control,
            string boolUpdateMethod,
            bool autoSize         = true,
            bool showOkButton     = true,
            bool showCancelButton = true,
            double desiredSize    = 0)
        {
            try
            {
                ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, true, autoSize, showOkButton, showCancelButton);

                ControlDialog.window.Closing += ControlDialog.ControlWindow_Closing;

                ControlDialog.window.Owner = Application.Current.MainWindow;

                if (desiredSize > ControlDialog.window.ScreenWidth().ToDouble())
                {
                    ControlDialog.FitToScreen();
                }

                return(ControlDialog.window.ShowDialog());
            }
            catch (Exception err)
            {
                MessageDisplay.Show(err.InnerExceptionMessage());

                return(false);
            }
        }
        public static void Show(string windowTitle, UserControlBase control,
                                string boolUpdateMethod,
                                bool showOkButton       = true,
                                bool showCancelButton   = true,
                                bool autoSize           = false,
                                WindowState windowState = WindowState.Normal)
        {
            try
            {
                ControlWindow window = new ControlWindow(windowTitle, control, boolUpdateMethod, showOkButton, showCancelButton);

                window.AutoSize = autoSize;

                if (windowState != WindowState.Normal)
                {
                    window.SourceInitialized += (s, a) =>
                    {
                        window.WindowStartupLocation = WindowStartupLocation.CenterScreen;

                        window.WindowState = windowState;
                    };
                }

                //window.WindowState = windowState;

                window.Closing += WindowShow_Closing;

                window.Show();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.InnerExceptionMessage());
            }
        }
        private void SetCurrent(int index)
        {
            int indexCheck = this.previousIndex;

            TabHeader activeHeader = this.TabItem(indexCheck);

            if (activeHeader != null)
            {
                activeHeader.IsSelected = false;
            }

            TabHeader item = this.TabItem(index);

            if (item == null)
            {
                return;
            }

            item.IsSelected = true;

            UserControlBase control = this.Items[index];

            TabHeader nextHeader = this.TabItem(index);

            this.Content = control;

            this.previousIndex = index;

            this.SelectedIndex = index;

            //this.uxContent.Title = control.Title;

            control.InvalidateVisual();
        }
Beispiel #6
0
        private static void LinkImage_Selected(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Image item = (Image)sender;

                string verseKey = item.Tag.ParseToString();

                Type linkViewerType = Type.GetType("Bibles.Link.LinkViewer,Bibles.Link");

                UserControlBase linkViewer = Activator.CreateInstance(linkViewerType, new object[] { verseKey }) as UserControlBase;

                if (ControlDialog.ShowDialog("Link Viewer", linkViewer, "SaveComments", autoSize: false).IsFalse())
                {
                    return;
                }

                string[] deletedLinks = linkViewer.GetPropertyValue("GetDeletedLinks").To <string[]>();

                foreach (string key in deletedLinks)
                {
                    BibleLoader.LinkViewerClosed?.Invoke(linkViewer, key);
                }
            }
            catch (Exception err)
            {
                ErrorLog.ShowError(err);
            }
        }
Beispiel #7
0
        public static void Show(string windowTitle,
                                UserControlBase control,
                                string boolUpdateMethod,
                                Window owner          = null,
                                bool isTopMost        = false,
                                bool autoSize         = true,
                                bool showOkButton     = true,
                                bool showCancelButton = true)
        {
            try
            {
                ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, false, autoSize, showOkButton, showCancelButton);

                if (owner != null)
                {
                    ControlDialog.window.Owner = owner;
                }

                ControlDialog.window.Topmost = isTopMost;

                ControlDialog.window.Show();
            }
            catch (Exception err)
            {
                MessageDisplay.Show(err.InnerExceptionMessage());
            }
            finally
            {
                ControlDialog.window = null;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);
            }
            if (GlobalContext.CurrentExperience.ExperienceType == Shared.ViewModel.ValueObjects.ExperienceType.Green &&
                HLConfigManager.Configurations.DOConfiguration.ChangeOrderingLeftMenuMyHL3)
            {
                (Master as OrderingMaster).IsleftMenuVisible         = true;
                (Master as OrderingMaster).IsleftOrderingMenuVisible = false;
            }
            var paymentsControl =
                LoadControl(HLConfigManager.Configurations.PaymentsConfiguration.PaymentInfoControl);

            ucPaymentInfoControl = paymentsControl as UserControlBase;
            phPaymentInfoControl.Controls.Add(paymentsControl);

            if (HLConfigManager.Configurations.PaymentsConfiguration.UseCardRegistry)
            {
                if (gvSavedPaymentInformation.Columns.Count > 0)
                {
                    gvSavedPaymentInformation.Columns[gvSavedPaymentInformation.Columns.Count - 1].Visible = false;
                    btnAddPaymentInfo.Visible = false;
                }
            }
            sortExpression       = ViewState["_GridView1LastSortExpression_"] as string;
            sortDirection        = ViewState["_GridView1LastSortDirection_"] as string;
            mpPaymentInformation = (ModalPopupExtender)ucPaymentInfoControl.FindControl("ppPaymentInfoControl");

            loadPaymentInformation();

            (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid col-sm-7 gdo-no-right-nav");
        }
        public static void Show(string windowTitle,
                                UserControlBase control,
                                string boolUpdateMethod,
                                Window owner          = null,
                                bool isTopMost        = false,
                                bool autoSize         = true,
                                bool showOkButton     = true,
                                bool showCancelButton = true,
                                double desiredSize    = 0)
        {
            try
            {
                ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, false, autoSize, showOkButton, showCancelButton);

                if (owner != null)
                {
                    ControlDialog.window.Owner = owner;
                }

                ControlDialog.window.Topmost = isTopMost;

                ControlDialog.window.Closing += ControlDialog.ControlWindow_Closing;

                if (desiredSize > ControlDialog.window.ScreenWidth().ToDouble())
                {
                    ControlDialog.FitToScreen();
                }

                ControlDialog.window.Show();
            }
            catch (Exception err)
            {
                MessageDisplay.Show(err.InnerExceptionMessage());
            }
        }
Beispiel #10
0
 public override UserControlBase[] ToolsWindows()
 {
     UserControlBase[] toolsWindows = new UserControlBase[2];
     toolsWindows[0] = twtToolsWindowsTemplates;
     toolsWindows[1] = twttoolsWindowsTags;
     return(toolsWindows);
 }
        public ControlWindow(string windowTitle,
                             UserControlBase control,
                             string boolUpdateMethod,
                             bool isDialog,
                             bool autoSize,
                             bool showOkButton,
                             bool showCancelButton)
        {
            this.InitializeComponent();

            this.isAsDialog = isDialog;

            this.isAutoZize = autoSize;

            this.AutoSize = autoSize;

            this.Title = windowTitle;

            this.uxOk.Visibility = showOkButton ? Visibility.Visible : Visibility.Collapsed;

            this.uxCancel.Visibility = showCancelButton ? Visibility.Visible : Visibility.Collapsed;

            this.uxContent.Content = control;

            this.boolUpdateMethodName = boolUpdateMethod;

            this.Loaded += this.ControlWindow_Loaded;
        }
Beispiel #12
0
        public override UserControlBase[] ToolsWindows()
        {
            UserControlBase[] toolsWindows = new UserControlBase[1];
            toolsWindows[0] = regExPropertys;

            return(toolsWindows);
        }
Beispiel #13
0
        private PropertiesToolsWindowsProperty MakePropertyText(string name, string caption, string value)
        {
            PropertiesToolsWindowsProperty propertiesToolsWindowsPart = new PropertiesToolsWindowsProperty(PropertiesToolsWindowsProperty.Type.Text);

            propertiesToolsWindowsPart.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                      | System.Windows.Forms.AnchorStyles.Right)));
            propertiesToolsWindowsPart.DownControl = null;
            //propertiesToolsWindowsPart.Location = new System.Drawing.Point(10, 5);
            propertiesToolsWindowsPart.Name            = name;
            propertiesToolsWindowsPart.ParentControl   = null;
            propertiesToolsWindowsPart.Size            = new System.Drawing.Size(pPanel.Width, propertiesToolsWindowsPart.Height);
            propertiesToolsWindowsPart.TabIndex        = 1;
            propertiesToolsWindowsPart.PropertyName    = name;
            propertiesToolsWindowsPart.PropertyCaption = caption;
            propertiesToolsWindowsPart.PropertyValue   = value;
            // subscribe to change event
            propertiesToolsWindowsPart.Change += new PropertiesToolsWindowsEventHandler(property_Change);

            if (lastAddedControl != null)
            {
                propertiesToolsWindowsPart.UpControl = (PropertiesToolsWindowsProperty)lastAddedControl;
            }
            this.pPanel.Controls.Add(propertiesToolsWindowsPart);

            lastAddedControl = propertiesToolsWindowsPart;

            return(propertiesToolsWindowsPart);
        }
Beispiel #14
0
        private PropertiesToolsWindowsProperty MakePropertyComboBox(string name, string caption, string[] values, string selected)
        {
            PropertiesToolsWindowsProperty propertiesToolsWindowsPart = new PropertiesToolsWindowsProperty(PropertiesToolsWindowsProperty.Type.ComboBox);

            propertiesToolsWindowsPart.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                      | System.Windows.Forms.AnchorStyles.Right)));
            propertiesToolsWindowsPart.DownControl = null;
            //propertiesToolsWindowsPart.Location = new System.Drawing.Point(10, 5);
            propertiesToolsWindowsPart.Name            = name;
            propertiesToolsWindowsPart.ParentControl   = null;
            propertiesToolsWindowsPart.Size            = new System.Drawing.Size(pPanel.Width, propertiesToolsWindowsPart.Height);
            propertiesToolsWindowsPart.TabIndex        = 1;
            propertiesToolsWindowsPart.PropertyName    = name;
            propertiesToolsWindowsPart.PropertyCaption = caption;
            // fill combobox with values
            propertiesToolsWindowsPart.PropertyListSet(values);
            // select default text
            propertiesToolsWindowsPart.PropertyValue = selected;
            // subscribe to change event
            propertiesToolsWindowsPart.Change += new PropertiesToolsWindowsEventHandler(property_Change);

            if (lastAddedControl != null)
            {
                propertiesToolsWindowsPart.UpControl = (PropertiesToolsWindowsProperty)lastAddedControl;
            }
            this.pPanel.Controls.Add(propertiesToolsWindowsPart);

            lastAddedControl = propertiesToolsWindowsPart;

            return(propertiesToolsWindowsPart);
        }
        private void WindowsShow_IsClosing(object sender, UserControlBase control, CancelEventArgs e)
        {
            try
            {
                if (control.GetType() != typeof(ReportDesigner))
                {
                    return;
                }

                ReportDesigner userControl = control.To <ReportDesigner>();

                ControlDialog.WindowsShowIsClosing -= this.WindowsShow_IsClosing;

                if (userControl.ReportMaster.MasterReport_Id <= 0)
                {   // User did not save the report
                    return;
                }

                this.HeadersAndFooters = this.HeadersAndFooters.Add(userControl.ReportMaster);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.InnerExceptionMessage());
            }
        }
Beispiel #16
0
        public static bool?ShowDialog(
            string windowTitle,
            UserControlBase control,
            string boolUpdateMethod,
            bool autoSize         = true,
            bool showOkButton     = true,
            bool showCancelButton = true)
        {
            try
            {
                ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, true, autoSize, showOkButton, showCancelButton);

                return(ControlDialog.window.ShowDialog());
            }
            catch (Exception err)
            {
                MessageDisplay.Show(err.InnerExceptionMessage());

                return(false);
            }
            finally
            {
                ControlDialog.window = null;
            }
        }
        private void CloseButton_Click(object sender)
        {
            TabHeader item = (TabHeader)sender;

            UserControlBase control = this.Items[item.TabIndex];

            this.Items.Remove(control);
        }
Beispiel #18
0
        private void LinkVerse_Cliked(object sender, RoutedEventArgs e)
        {
            if (this.SelectedVerseKey.IsNullEmptyOrWhiteSpace() ||
                Formatters.GetVerseFromKey(this.SelectedVerseKey) <= 0 ||
                this.SelectedSide == ParalelleSideEnum.None)
            {
                MessageDisplay.Show("Please select a Verse.");

                return;
            }

            try
            {
                Type linkType = Type.GetType("Bibles.Link.LinkEditor,Bibles.Link");

                object[] args = new object[]
                {
                    this.selectedBibleId,
                    this.SelectedSide == ParalelleSideEnum.Left ?
                    this.versesDictionaryLeft[Formatters.GetVerseFromKey(this.SelectedVerseKey)]
                        :
                    this.versesDictionaryRight[Formatters.GetVerseFromKey(this.SelectedVerseKey)]
                };

                UserControlBase linkEditor = Activator.CreateInstance(linkType, args) as UserControlBase;

                string title = $"Link - {GlobalStaticData.Intance.GetKeyDescription(this.SelectedVerseKey)}";

                linkEditor.Height = this.Height;

                if (ControlDialog.ShowDialog(title, linkEditor, "AcceptLink", false).IsFalse())
                {
                    return;
                }

                int selectedVerse = Formatters.GetVerseFromKey(this.selectedKey);

                BibleLoader.RefreshVerseNumberPanel
                (
                    this.loadedVerseStackDictionaryLeft[selectedVerse],
                    this.BibleLeft.BibleId,
                    this.versesDictionaryLeft[selectedVerse]
                );

                BibleLoader.RefreshVerseNumberPanel
                (
                    this.loadedVerseStackDictionaryRight[selectedVerse],
                    this.BibleRight.BibleId,
                    this.versesDictionaryRight[selectedVerse]
                );
            }
            catch (Exception err)
            {
                ErrorLog.ShowError(err);
            }
        }
 public void AddControls(UserControlBase[] userControlsBase)
 {
     if (userControlsBase != null)
     {
         foreach (UserControlBase userControlBase in userControlsBase)
         {
             pPanelOne.Controls.Add(userControlBase);
         }
     }
 }
Beispiel #20
0
        private void EditStudy_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (this.SelectedStudyHeader == null)
            {
                MessageDisplay.Show("Please select a Study.");

                return;
            }

            try
            {
                #region CHECK FOR OPEN STUDIES

                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() != typeof(ControlWindow))
                    {
                        continue;
                    }

                    UserControlBase controlBase = window.GetPropertyValue("ControlContent").To <UserControlBase>();

                    if (controlBase.GetType() != typeof(EditStudy))
                    {
                        continue;
                    }

                    StudyHeader studyHeader = controlBase.GetPropertyValue("SubjectHeader").To <StudyHeader>();

                    if (studyHeader.StudyHeaderId <= 0)
                    {
                        continue;
                    }

                    window.Focus();

                    this.CloseIfNotMainWindow(true);

                    return;
                }

                #endregion


                EditStudy edit = new EditStudy(this.SelectedStudyHeader);

                ControlDialog.Show(this.SelectedStudyHeader.StudyName, edit, "SaveStudy", autoSize: false);

                this.CloseIfNotMainWindow(true);
            }
            catch (Exception err)
            {
                ErrorLog.ShowError(err);
            }
        }
Beispiel #21
0
        private static void StudyBookmark_Selected(object sender, RoutedEventArgs e)
        {
            try
            {
                MenuItem item = (MenuItem)sender;

                string studyKey = item.Tag.ParseToString();

                string[] keySplit = studyKey.Split(new string[] { "||" }, StringSplitOptions.None);

                int studyHeaderId = keySplit[0].ToInt32();

                #region CHECK FOR OPEN STUDIES

                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() != typeof(ControlWindow))
                    {
                        continue;
                    }

                    UserControlBase controlBase = window.GetPropertyValue("ControlContent").To <UserControlBase>();

                    if (controlBase.GetType() != typeof(EditStudy))
                    {
                        continue;
                    }

                    StudyHeader studyHeader = controlBase.GetPropertyValue("SubjectHeader").To <StudyHeader>();

                    if (studyHeader.StudyHeaderId <= 0)
                    {
                        continue;
                    }

                    window.Focus();

                    return;
                }

                #endregion

                StudyHeaderModel model = BiblesData.Database.GetStudyHeader(studyHeaderId.ToInt32());

                EditStudy edit = new EditStudy(model);

                ControlDialog.Show(model.StudyName, edit, "SaveStudy", autoSize: false);
            }
            catch (Exception err)
            {
                ErrorLog.ShowError(err);
            }
        }
        public QViewForm(UserControl control)
        {
            this.Controls.Add(control);
            _control     = control;
            _controlbase = control as UserControlBase;
            if (_controlbase != null)
            {
                _controlbase.OnSettingsListChanged += new EventHandler(OnSettingsListChanged);
            }

            control.Dock = DockStyle.Fill;
        }
Beispiel #23
0
        public ToolWindow ShowViewInWindow(UserControlBase view)
        {
            //throw new NotImplementedException();
            InternalWindow dialog = new InternalWindow();

            dialog.Parent        = ShellPanel();
            dialog.CanResize     = true;
            dialog.ShowStatusBar = false;
            dialog.StartPosition = ToolWindowStartPosition.CenterParent;
            dialog.GridContent.Children.Add(view);
            dialog.Show();
            return(dialog);
        }
        public int GetNextInstanceIndex(int itemIndex, string headerText)
        {
            int result = 0;

            UserControlBase indexItem = this.Items[itemIndex];

            foreach (UserControlBase item in this.Items)
            {
                if (item.Name == indexItem.Name)
                {
                    result++;
                }
            }

            // This is to slow, test it if you would like to, maybe it was my machine
            // UserControlBase[] items = this.Items.Where(i => i.InstanceID == indexItem.InstanceID).ToArray();
            if (result <= 1)
            {
                return(0);
            }

            UIElement[] elements = this.Tabs.FindVisualControls(typeof(TabHeader));

            foreach (UIElement item in elements)
            {
                if (((TabHeader)item).HeaderText.StartsWith(headerText))
                {
                    string[] nameValArray = ((TabHeader)item).HeaderText.Split(' ');

                    if (nameValArray.Length == 0)
                    {
                        return(0);
                    }

                    nameValArray[nameValArray.Length - 1] =
                        nameValArray[nameValArray.Length - 1].Replace("(", string.Empty).Replace(")", string.Empty);

                    int checkInt = 0;

                    if (int.TryParse(nameValArray[nameValArray.Length - 1], out checkInt))
                    {
                        if (checkInt >= result)
                        {
                            result = checkInt + 1;
                        }
                    }
                }
            }

            return(result);
        }
            private void Views_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
            {
                Window owner = _ownerWeakReference.Target as Window;

                if (owner == null)
                {
                    Detach();
                    return;
                }

                if (e.Action == NotifyCollectionChangedAction.Add)
                {
                    foreach (object view in e.NewItems)
                    {
                        UserControlBase content = view as UserControlBase;
                        if (content != null)
                        {
                            Window window = new Window();
                            window.Activated   += new EventHandler(window_Activated);
                            window.Deactivated += new EventHandler(window_Deactivated);
                            window.Style        = _windowStyle;

                            if (content != null)
                            {
                                window.Title  = content.Title;
                                window.Height = (Double.IsNaN(content.Height) ? content.ActualHeight + 50 : content.Height + 50);
                                window.Width  = (Double.IsNaN(content.Width) ? content.ActualWidth + 30 : content.Width + 30);
                                content.InitEvent(window.Close);
                            }
                            window.Content = view;
                            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            window.Closed += new EventHandler(window_Closed);
                            window.Owner   = owner;
                            window.Show();
                        }
                    }
                }
                else if (e.Action == NotifyCollectionChangedAction.Remove)
                {
                    foreach (object view in e.OldItems)
                    {
                        Window window = GetContainerWindow(owner, view);

                        if (window != null)
                        {
                            window.Close();
                        }
                    }
                }
            }
Beispiel #26
0
        private void SelectedVerse_Changed(object sender, string key)
        {
            try
            {
                UserControlBase item = this.uxMainTab.Items[this.uxMainTab.SelectedIndex];

                item.InvokeMethod(item, "SetVerse", new object[] { key }, false);

                this.selectedItemKey = key;
            }
            catch (Exception err)
            {
                ErrorLog.ShowError(err);
            }
        }
        public ControlWindow(string windowTitle, UserControlBase control, string boolUpdateMethod, bool showOkButton, bool showCancelButton)
        {
            this.InitializeComponent();

            this.Title = windowTitle;

            this.uxContent.Content = control;

            this.boolUpdateMethodName = boolUpdateMethod;

            this.uxButtonOk.Visibility = showOkButton ? Visibility.Visible : Visibility.Collapsed;

            this.uxButtonCancel.Visibility = showCancelButton ? Visibility.Visible : Visibility.Collapsed;

            //this.Loaded += this.ControlWindow_Loaded;
        }
Beispiel #28
0
        public static TagControl GetControlInstance(Panel panel, Tag tag, UserControlBase upControl, UserControlBase downControl)
        {
            //UserControlBase control;
            TagControl control;
            control = new TagControl(tag);

            control.Location = new System.Drawing.Point(10, 20);
            //rowCollection.Name = "Data" + columnCount;
            control.Size = new System.Drawing.Size(800, 30);
            control.TabIndex = 0;

            control.UpControl = upControl;
            control.DownControl = downControl;
            panel.Controls.Add(control);
            return control;
        }
Beispiel #29
0
        public static TagControl GetControlInstance(Panel panel, Tag tag, UserControlBase upControl, UserControlBase downControl)
        {
            //UserControlBase control;
            TagControl control;

            control = new TagControl(tag);

            control.Location = new System.Drawing.Point(10, 20);
            //rowCollection.Name = "Data" + columnCount;
            control.Size     = new System.Drawing.Size(800, 30);
            control.TabIndex = 0;

            control.UpControl   = upControl;
            control.DownControl = downControl;
            panel.Controls.Add(control);
            return(control);
        }
        public bool TryEditStudy()
        {
            if (this.SelectedStudyHeader == null)
            {
                MessageDisplay.Show("Please select a Study.");

                return(false);
            }

            #region CHECK FOR OPEN STUDIES

            foreach (Window window in Application.Current.Windows)
            {
                if (window.GetType() != typeof(ControlWindow))
                {
                    continue;
                }

                UserControlBase controlBase = window.GetPropertyValue("ControlContent").To <UserControlBase>();

                if (controlBase.GetType() != typeof(EditStudy))
                {
                    continue;
                }

                StudyHeader studyHeader = controlBase.GetPropertyValue("SubjectHeader").To <StudyHeader>();

                if (studyHeader.StudyHeaderId <= 0 ||
                    studyHeader.StudyHeaderId != this.SelectedStudyHeader.StudyHeaderId)
                {
                    continue;
                }

                window.Focus();

                return(true);
            }

            #endregion

            EditStudy edit = new EditStudy(this.SelectedStudyHeader);

            ControlDialog.Show(this.SelectedStudyHeader.StudyName, edit, "SaveStudy", autoSize: false, owner: Application.Current.MainWindow);

            return(true);
        }
            private void window_Closed(object sender, EventArgs e)
            {
                Window          window   = sender as Window;
                IRegion         region   = _regionWeakReference.Target as IRegion;
                UserControlBase userbase = window.Content as UserControlBase;

                if (userbase != null)
                {
                    userbase.Close();
                }
                if (window != null && region != null)
                {
                    if (region.Views.Contains(window.Content))
                    {
                        region.Remove(window.Content);
                    }
                }
            }
        private void LinkVerse_Cliked(object sender, RoutedEventArgs e)
        {
            if (this.selectedKey.IsNullEmptyOrWhiteSpace())
            {
                MessageDisplay.Show("Please select a Verse.");

                return;
            }

            try
            {
                Type linkType = Type.GetType("Bibles.Link.LinkEditor,Bibles.Link");

                BibleVerseModel verseModel = this.uxSearchPager
                                             .ItemsSource
                                             .Items
                                             .FirstOrDefault(vk => ((BibleVerseModel)vk).BibleVerseKey == this.selectedKey)
                                             .To <BibleVerseModel>();

                object[] args = new object[]
                {
                    Formatters.GetBibleFromKey(this.selectedKey),
                    verseModel
                };

                UserControlBase linkEditor = Activator.CreateInstance(linkType, args) as UserControlBase;

                string title = $"Link - {GlobalStaticData.Intance.GetKeyDescription(this.selectedKey)}";

                linkEditor.Height = this.Height;

                if (ControlDialog.ShowDialog(title, linkEditor, "AcceptLink", false).IsFalse())
                {
                    return;
                }

                int selectedVerse = Formatters.GetVerseFromKey(this.selectedKey);
            }
            catch (Exception err)
            {
                ErrorLog.ShowError(err);
            }
        }
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (buttonX1.Text == "保存")
            {
                userControl?.SaveDataConnection();
                MessageBoxEx.Show("保存成功", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                groupPanel1.Text = "配置数据库连接";
                controls         = groupPanel1.Controls.Cast <Control>().Where(a => (a is CheckBoxX checkBox)).ToArray();
                groupPanel1.Controls.Clear();
                var checkbox = controls.Where(a => (a is CheckBoxX checkBox) && checkBox.Checked).FirstOrDefault();
                if (checkbox == null)
                {
                    return;
                }
                switch (checkbox.Text)
                {
                case "MySql": userControl = new UcMysql(); break;

                case "SqlServer": userControl = new UcSqlServer(); break;

                case "PostgreSQL": userControl = new UcPostgreSQL(); break;

                case "Oracle": userControl = new UcOracle(); break;

                case "Sqlite": userControl = new UcSqlite(); break;

                case "自定义": userControl = new UCConnection(); break;
                }
                userControl.BackColor = Color.Transparent;
                userControl.Dock      = DockStyle.Fill;
                groupPanel1.Controls.Add(userControl);
                buttonX2.Visible = true;
                buttonX3.Visible = true;
                buttonX1.Text    = "保存";
            }
        }
 public override UserControlBase[] ToolsWindows()
 {
     UserControlBase[] toolsWindows = new UserControlBase[2];
     toolsWindows[0] = twtToolsWindowsTemplates;
     toolsWindows[1] = twttoolsWindowsTags;
     return toolsWindows;
 }
Beispiel #35
0
 public ToolWindow ShowViewInWindow(UserControlBase view)
 {
     //throw new NotImplementedException();
     InternalWindow dialog = new InternalWindow();
     dialog.Parent = ShellPanel();
     dialog.CanResize = true;
     dialog.ShowStatusBar = false;
     dialog.StartPosition = ToolWindowStartPosition.CenterParent;
     dialog.GridContent.Children.Add(view);
     dialog.Show();
     return dialog;
 }
 public void AddControls(UserControlBase userControlBase)
 {
     pPanelOne.Controls.Add(userControlBase);
 }
        private PropertiesToolsWindowsProperty MakePropertyTrueFalse(string name, string caption, bool selected)
        {
            PropertiesToolsWindowsProperty propertiesToolsWindowsPart = new PropertiesToolsWindowsProperty(PropertiesToolsWindowsProperty.Type.TrueFalse);

            propertiesToolsWindowsPart.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            propertiesToolsWindowsPart.DownControl = null;
            //propertiesToolsWindowsPart.Location = new System.Drawing.Point(10, 5);
            propertiesToolsWindowsPart.Name = name;
            propertiesToolsWindowsPart.ParentControl = null;
            propertiesToolsWindowsPart.Size = new System.Drawing.Size(pPanel.Width, propertiesToolsWindowsPart.Height);
            propertiesToolsWindowsPart.TabIndex = 1;
            propertiesToolsWindowsPart.PropertyName = name;
            propertiesToolsWindowsPart.PropertyCaption = caption;
            // select default text
            propertiesToolsWindowsPart.PropertyValueTrueFalse = selected;
            // subscribe to change event
            propertiesToolsWindowsPart.Change += new PropertiesToolsWindowsEventHandler(property_Change);

            if (lastAddedControl != null)
            {
                propertiesToolsWindowsPart.UpControl = (PropertiesToolsWindowsProperty)lastAddedControl;
            }
            this.pPanel.Controls.Add(propertiesToolsWindowsPart);

            lastAddedControl = propertiesToolsWindowsPart;

            return propertiesToolsWindowsPart;
        }