Exemplo n.º 1
0
        private void Manager_event_FromForm(object sender, myEventArgs e)
        {
            if (e.EventArgs_ButtonLabel == "Button")
            {
                button_UC              = e.EventArgs_UC;
                button_MinMax          = e.EventArgs_MinMax;
                button_RectangleSquare = e.EventArgs_RectangleSquare;
                button_RGB             = e.EventArgs_RGB;
                button_MinMax_RectangleSquare_control = ((Form1)sender).ButtonLabel_MinMax_RectangleSquare_control;
            }
            else
            {
                label_UC              = e.EventArgs_UC;
                label_MinMax          = e.EventArgs_MinMax;
                label_RectangleSquare = e.EventArgs_RectangleSquare;
                label_RGB             = e.EventArgs_RGB;
                label_MinMax_RectangleSquare_control = ((Form1)sender).ButtonLabel_MinMax_RectangleSquare_control;
            }

            counterEvents++;
            if (counterEvents == 2)
            {
                Action();
            }
        }
Exemplo n.º 2
0
        private void UserControl1_Click(object sender, EventArgs e)
        {
            myEventArgs temp = new myEventArgs(this, null);

            if (myEvent != null)
            {
                myEvent(this, temp);
            }
        }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: Gwee/csharp
        private void fromUserControl1(object sender, myEventArgs e)
        {
            myEventArgs temp = new myEventArgs(e.uc, this);

            if (UCEvent != null)
            {
                UCEvent(this, temp);
            }
        }
Exemplo n.º 4
0
        private void FromFormTrigger(object sender, myEventArgs e)
        {
            Form             triggeredForm = (Form)sender;
            Form             form;
            List <Control>   UserControls = new List <Control>();
            List <myControl> RetControls  = new List <myControl>();

            if (triggeredForm == myForm_1)
            {
                form = myForm_2;
            }
            else
            {
                form = myForm_1;
            }
            UserControls = Utils.Helper.getAllUserControls(triggeredForm, form);

            foreach (UserControl uc in UserControls)
            {
                foreach (Control control in uc.Controls)
                {
                    if (control.BackColor == Color.FromName(Utils.Helper.getColor(triggeredForm).Text) && control.GetType().Name == triggeredForm.Text && Utils.Helper.getControlShapeType(control) == Utils.Helper.getSelectedShapeType(triggeredForm))
                    {
                        RetControls.Add(new myControl(control.BackColor, control.GetType(), control.Width, control.Height));
                        //Console.WriteLine(control.Name);
                    }
                }
            }
            e.uc.BackColor = Color.Blue;
            Console.WriteLine("hi");
            Control repl = triggeredForm.Controls.Find("ButtonLabel_MinMax_RectangleSquare_control", false).Single();

            switch (Utils.Helper.getMinMax(triggeredForm))
            {
            case ShapeSize.Min:
                Utils.Helper.placeMinControlInForm(triggeredForm, RetControls, repl);
                break;

            case ShapeSize.Max:
                Utils.Helper.placeMaxControlInForm(triggeredForm, RetControls, repl);
                break;

            default:
                break;
            }
            //Utils.Helper.placeMinMaxControlInForm(triggeredForm, RetControls, Utils.Helper.getMinMax(triggeredForm));
        }
Exemplo n.º 5
0
        private void my_managerTrigger(object sender, myEventArgs e)
        {
            Control[] result = new Control[] { };

            Form fired_form = (Form)sender;
            Form form       = myForm_1 != fired_form ? myForm_1 : myForm_2;

            Control[] controls = getControls(fired_form, form);

            var typeControl = EnumHelper.controlType(fired_form.Text);
            var shape       = EnumHelper.controlShape(FooStack.GetControlByName(fired_form, "Rectangle_Square_label").Text);
            var size        = EnumHelper.controlSize(FooStack.GetControlByName(fired_form, "Min_Max_label").Text);
            var color       = EnumHelper.controlColor(FooStack.GetCheckedControl(fired_form).Text);
            var resultArea1 = FooStack.GetControlByName(fired_form, "ButtonLabel_MinMax_RectangleSquare_control");
            var resultArea2 = e.userControl;

            Process process = new Process(controls, typeControl, color, size, shape);

            setResult(process.getControls(), process.getControl(), resultArea1, resultArea2);
        }
Exemplo n.º 6
0
        private void Form_event_FromUC(object sender, myEventArgs e)
        {
            e.EventArgs_ButtonLabel     = this.Text;
            e.EventArgs_MinMax          = Min_Max_label.Text;
            e.EventArgs_RectangleSquare = Rectangle_Square_label.Text;

            if (radioButtonRed.Checked)
            {
                e.EventArgs_RGB = "Red";
            }
            if (radioButtonGreen.Checked)
            {
                e.EventArgs_RGB = "Green";
            }
            if (radioButtonBlue.Checked)
            {
                e.EventArgs_RGB = "Blue";
            }

            if (event_From_Form != null)
            {
                event_From_Form(this, e);
            }
        }
Exemplo n.º 7
0
Arquivo: Form1.cs Projeto: Gwee/csharp
        public void my_formTrigger(object sender, myEventArgs e)
        {
            myEventArgs myEventArgs_temp = new myEventArgs(this, e.userControl);

            myCallbackFormEvent(this, myEventArgs_temp); //throw form to the parent
        }
Exemplo n.º 8
0
Arquivo: Form1.cs Projeto: Gwee/csharp
        private void fromUserControl(object sender, myEventArgs e)
        {
            foreach (Control control in e.arrControls)
            {
                if (control.BackColor == getSelectedColor() && control.GetType().Name == this.Text && getControlShapeType(control) == getSelectedShapeType())
                {
                    controlList.Add(new myControl(control.BackColor, control.GetType(), control.Width, control.Height));
                }
            }

            //TODO: Fix this ugly code
            switch (Min_Max_label.Text)
            {
            case "Min":
                myControl min = getMinControl(controlList);
                if (min == null)
                {
                    MessageBox.Show("No minimum control found");
                    break;
                }


                if (min.myType.Name == "Label")
                {
                    Label newLbl = min.convertToLabel();
                    newLbl.Location = ButtonLabel_MinMax_RectangleSquare_control.Location;
                    Controls.Remove(ButtonLabel_MinMax_RectangleSquare_control);
                    this.Controls.Add(newLbl);
                    newLbl.Visible = true;
                    ButtonLabel_MinMax_RectangleSquare_control = newLbl;
                    controlList.Clear();
                }
                else
                {
                    Button newBtn = min.convertToButton();
                    newBtn.Location = ButtonLabel_MinMax_RectangleSquare_control.Location;
                    Controls.Remove(ButtonLabel_MinMax_RectangleSquare_control);
                    this.Controls.Add(newBtn);
                    newBtn.Visible = true;
                    ButtonLabel_MinMax_RectangleSquare_control = newBtn;
                    controlList.Clear();
                }
                break;

            case "Max":
                myControl max = getMaxControl(controlList);
                if (max == null)
                {
                    MessageBox.Show("No minimum control found");
                    break;
                }
                if (max.myType.Name == "Label")
                {
                    Label newLbl = max.convertToLabel();
                    newLbl.Location = ButtonLabel_MinMax_RectangleSquare_control.Location;
                    Controls.Remove(ButtonLabel_MinMax_RectangleSquare_control);
                    this.Controls.Add(newLbl);
                    newLbl.Visible = true;
                    controlList.Clear();
                }
                else
                {
                    Button newBtn = max.convertToButton();
                    newBtn.Location = ButtonLabel_MinMax_RectangleSquare_control.Location;
                    Controls.Remove(ButtonLabel_MinMax_RectangleSquare_control);
                    this.Controls.Add(newBtn);
                    newBtn.Visible = true;
                    controlList.Clear();
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 9
0
        private void UserControl1_Click(object sender, EventArgs e)
        {
            myEventArgs myEventArgs_temp = new myEventArgs(null, this);

            myUCCallbackEvent(this, myEventArgs_temp); //throw user control to the parent
        }