Exemple #1
0
        private void btnAddSplit_Click(object sender, EventArgs e)
        {
            SplitterSplitSettings setting = new SplitterSplitSettings();
            List <string>         names   = GetAvailableDescriptions <SplitName>();

            setting.cboSplit.DataSource = names;
            setting.cboSplit.Text       = names[0];
            AddHandlers(setting);

            flowMain.Controls.Add(setting);
            UpdateSplits();
        }
Exemple #2
0
        public void SetSettings(XmlNode settings)
        {
            Splits.Clear();
            XmlNodeList splitNodes = settings.SelectNodes(".//Splits/Split");

            foreach (XmlNode splitNode in splitNodes)
            {
                string    splitDescription = splitNode.InnerText;
                SplitName split            = SplitterSplitSettings.GetEnumValue <SplitName>(splitDescription);
                Splits.Add(split);
            }
        }
Exemple #3
0
        public void UpdateSplits()
        {
            if (isLoading)
            {
                return;
            }

            Splits.Clear();
            foreach (Control control in flowMain.Controls)
            {
                if (control is SplitterSplitSettings)
                {
                    SplitterSplitSettings setting = (SplitterSplitSettings)control;
                    if (!string.IsNullOrEmpty(setting.cboSplit.Text))
                    {
                        Splits.Add(SplitterSplitSettings.GetEnumValue <SplitName>(setting.cboSplit.Text));
                    }
                }
            }
        }
Exemple #4
0
        public void LoadSettings()
        {
            isLoading = true;
            this.flowMain.SuspendLayout();

            for (int i = flowMain.Controls.Count - 1; i > 0; i--)
            {
                flowMain.Controls.RemoveAt(i);
            }

            foreach (SplitName split in Splits)
            {
                SplitterSplitSettings setting = new SplitterSplitSettings();
                setting.cboSplit.DataSource = GetAvailableDescriptions <SplitName>();
                setting.cboSplit.Text       = SplitterSplitSettings.GetEnumDescription <SplitName>(split);
                AddHandlers(setting);

                flowMain.Controls.Add(setting);
            }

            isLoading = false;
            this.flowMain.ResumeLayout(true);
        }
Exemple #5
0
        private void flowMain_DragOver(object sender, DragEventArgs e)
        {
            SplitterSplitSettings data        = (SplitterSplitSettings)e.Data.GetData(typeof(SplitterSplitSettings));
            FlowLayoutPanel       destination = (FlowLayoutPanel)sender;
            Point p     = destination.PointToClient(new Point(e.X, e.Y));
            var   item  = destination.GetChildAtPoint(p);
            int   index = destination.Controls.GetChildIndex(item, false);

            if (index == 0)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                e.Effect = DragDropEffects.Move;
                int oldIndex = destination.Controls.GetChildIndex(data);
                if (oldIndex != index)
                {
                    destination.Controls.SetChildIndex(data, index);
                    destination.Invalidate();
                }
            }
        }
Exemple #6
0
 private void RemoveHandlers(SplitterSplitSettings setting)
 {
     setting.cboSplit.SelectedIndexChanged -= ControlChanged;
     setting.btnRemove.Click -= btnRemove_Click;
 }
Exemple #7
0
 private void AddHandlers(SplitterSplitSettings setting)
 {
     setting.cboSplit.SelectedIndexChanged += new EventHandler(ControlChanged);
     setting.btnRemove.Click += new EventHandler(btnRemove_Click);
 }