Ejemplo n.º 1
0
        private void button_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            switch (b.Tag.ToString())
            {
            case "Power":
                if (currentState_label.Text != "Sincronizando")
                {
                    if (mirrorMode_radiobutton.Checked)
                    {
                        RebuildForm rebuildForm = new RebuildForm();
                        rebuildForm.ShowDialog(this);
                        if (rebuildForm.DialogResult == DialogResult.OK)
                        {
                            StartEvent(DmName, mirrorMode_radiobutton.Checked, rebuildForm.RebuildOption, Identifier, Index, trackChangedChk.Checked);
                        }
                    }
                    else
                    {
                        StartEvent(DmName, mirrorMode_radiobutton.Checked, -1, Identifier, Index, trackChangedChk.Checked);
                    }
                    //setStart();
                }
                else
                {
                    setStopped();
                    StopEvent(Identifier);
                }
                break;

            case "Edit":
                EditForm editForm = new EditForm();
                editForm.Text            = "Edit";
                editForm.DmName          = DmName;
                editForm.SourceDirectory = SourceDirectory;
                editForm.MirrorDirectory = MirrorDirectory;
                editForm.Timer           = Timer;
                editForm.Buffer          = Buffer;
                editForm.ShowDialog(this);
                if (editForm.DialogResult == DialogResult.OK)
                {
                    DmHolder dmh = new DmHolder();
                    dmh.Name       = editForm.DmName;
                    dmh.SourcePath = editForm.SourceDirectory;
                    dmh.MirrorPath = editForm.MirrorDirectory;
                    dmh.Buffer     = editForm.Buffer;
                    dmh.Timer      = editForm.Timer;
                    dmh.Identifier = Identifier;
                    UpdateEvent(dmh);
                }

                break;

            case "Delete":
                DeleteEvent(Identifier);
                break;

            default:
                break;
            }
        }