Exemplo n.º 1
0
        public void UpdateSplits()
        {
            if (isLoading)
            {
                return;
            }

            AlphaSort = rdSortAlpha.Checked;

            Splits.Clear();
            foreach (Control c in flowMain.Controls)
            {
                if (c is OriSplitSettings)
                {
                    OriSplitSettings setting = (OriSplitSettings)c;
                    if (!string.IsNullOrEmpty(setting.cboName.Text) && !string.IsNullOrEmpty(setting.txtValue.Text))
                    {
                        OriSplit split = new OriSplit(setting.cboName.Text, setting.txtValue.Text, setting.chkShouldSplit.Checked);
                        Splits.Add(split);
                    }
                }
            }

            ShowMapDisplay = chkShowMapDisplay.Checked;
            RainbowDash    = chkRainbowDash.Checked;
        }
Exemplo n.º 2
0
 private void AddHandlers(OriSplitSettings setting)
 {
     setting.txtValue.TextChanged         += new EventHandler(txtValue_TextChanged);
     setting.cboName.SelectedIndexChanged += new EventHandler(cboName_SelectedIndexChanged);
     setting.btnRemove.Click += new EventHandler(btnRemove_Click);
     setting.chkShouldSplit.CheckedChanged += new EventHandler(chkBox_CheckedChanged);
 }
Exemplo n.º 3
0
        public void LoadSettings()
        {
            isLoading = true;
            this.flowMain.SuspendLayout();

            for (int i = flowMain.Controls.Count - 1; i > 0; i--)
            {
                Control c = flowMain.Controls[i];
                if (c is OriSplitSettings)
                {
                    RemoveHandlers((OriSplitSettings)c);
                    flowMain.Controls.RemoveAt(i);
                }
            }

            foreach (OriSplit split in Splits)
            {
                OriSplitSettings setting = new OriSplitSettings();
                setting.cboName.DisplayMember  = "SplitName";
                setting.cboName.ValueMember    = "Type";
                setting.cboName.DataSource     = SplitComboData();
                setting.cboName.Text           = split.Field;
                setting.txtValue.Text          = split.Value;
                setting.chkShouldSplit.Checked = split.ShouldSplit;
                AddHandlers(setting);
                flowMain.Controls.Add(setting);
            }

            chkShowMapDisplay.Checked = ShowMapDisplay;
            chkRainbowDash.Checked    = RainbowDash;

            isLoading = false;
            this.flowMain.ResumeLayout(true);
        }
Exemplo n.º 4
0
 private void RemoveHandlers(OriSplitSettings setting)
 {
     setting.txtValue.TextChanged         -= txtValue_TextChanged;
     setting.cboName.SelectedIndexChanged -= cboName_SelectedIndexChanged;
     setting.btnRemove.Click -= btnRemove_Click;
     setting.btnUp.Click     -= btnUp_Click;
     setting.btnDown.Click   -= btnDown_Click;
 }
Exemplo n.º 5
0
        private void btnAddSplit_Click(object sender, EventArgs e)
        {
            OriSplitSettings setting = new OriSplitSettings();

            setting.cboName.DisplayMember  = "SplitName";
            setting.cboName.ValueMember    = "Type";
            setting.cboName.DataSource     = SplitComboData();
            setting.cboName.Text           = "Start Game";
            setting.txtValue.Text          = "True";
            setting.chkShouldSplit.Checked = true;
            AddHandlers(setting);

            flowMain.Controls.Add(setting);
            UpdateSplits();
        }
Exemplo n.º 6
0
 private void rdSort_CheckedChanged(object sender, EventArgs e)
 {
     foreach (Control c in flowMain.Controls)
     {
         if (c is OriSplitSettings)
         {
             OriSplitSettings setting  = (OriSplitSettings)c;
             object           selected = setting.cboName.SelectedItem;
             string           value    = setting.txtValue.Text;
             DataTable        dt       = (DataTable)setting.cboName.DataSource;
             if (rdSortAlpha.Checked)
             {
                 dt.DefaultView.Sort = "SplitName";
             }
             else
             {
                 dt.DefaultView.Sort = null;
             }
             setting.cboName.SelectedItem = selected;
             setting.txtValue.Text        = value;
         }
     }
 }
Exemplo n.º 7
0
        private void flowMain_DragOver(object sender, DragEventArgs e)
        {
            OriSplitSettings data        = (OriSplitSettings)e.Data.GetData(typeof(OriSplitSettings));
            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();
                }
            }
        }