Example #1
0
        //修改组
        private void ModifyGroup(object sender, RoutedEventArgs e)
        {
            SHHOPCGroup node = tree.SelectedItem as SHHOPCGroup;
            FormGroup   form = new FormGroup();

            //载入参数
            form.tbx_Name.Text              = node.Name;
            form.tbx_UpdateRate.Text        = node.UpdateRate.ToString();
            form.tbx_DeadBend.Text          = node.DeadBend.ToString();
            form.tbx_TimeBias.Text          = node.TimeBias.ToString();
            form.cbx_IsActive.IsChecked     = node.IsActive;
            form.cbx_IsSubscribed.IsChecked = node.IsSubscribed;

            form.Owner = this;
            if ((bool)form.ShowDialog())
            {
                //确定修改
                node.Name         = form.Name;
                node.UpdateRate   = form.UpdateRate;
                node.DeadBend     = form.DeadBend;
                node.TimeBias     = form.TimeBias;
                node.IsActive     = form.IsActive;
                node.IsSubscribed = form.IsSubscribed;


                OPCManager.ModifyGroup(node);
            }
        }
Example #2
0
        //添加组
        private void AddGroup(object sender, RoutedEventArgs e)
        {
            FormGroup form = new FormGroup();

            form.Owner = this;
            if ((bool)form.ShowDialog())
            {
                OPCManager.AddGroup((SHHOPCServer)tree.SelectedItem, new SHHOPCGroup(Guid.NewGuid(), form.Name, form.UpdateRate, form.DeadBend, form.TimeBias, form.IsActive, form.IsSubscribed));
            }
        }
Example #3
0
        private void btnGroupsEdit_Click(object sender, System.EventArgs e)
        {
            Dictionary <int, FormGroup> updatedList = new Dictionary <int, FormGroup>();

            foreach (DataGridViewRow row in dataGridViewGroup.Rows)
            {
                if (row.Cells[0].Value != null &&
                    (bool)row.Cells[0].Value)
                {
                    // show the form user
                    int       groupId   = (int)row.Cells[1].Value;
                    string    groupName = (string)row.Cells[2].Value;
                    FormGroup formGroup = new FormGroup(groupName);
                    formGroup.Text = "Edit Group";
                    formGroup.SetMonitorList(groupPresenter.GetMonitorsList());
                    formGroup.SetApplicationList(groupPresenter.GetApplicationList());

                    formGroup.GroupName          = groupName;
                    formGroup.WholeDesktop       = (bool)row.Cells[3].Value;
                    formGroup.AllowMaintenance   = (bool)row.Cells[4].Value;
                    formGroup.AllowRemoteControl = (bool)row.Cells[5].Value;
                    formGroup.SetSelectedApplications(groupPresenter.GetApplicationsId(groupId));
                    int currentMonitorId = groupPresenter.GetMonitorId(groupId);
                    if (currentMonitorId != -1)
                    {
                        formGroup.MonitorId = currentMonitorId;
                    }


                    if (formGroup.ShowDialog(this) == System.Windows.Forms.DialogResult.OK &&
                        formGroup.IsDirty)
                    {
                        updatedList.Add(groupId, formGroup);
                    }
                }
            }

            foreach (KeyValuePair <int, FormGroup> data in updatedList)
            {
                // add to database
                groupPresenter.EditGroup(
                    data.Key,
                    data.Value.GroupName,
                    data.Value.WholeDesktop,
                    data.Value.AllowMaintenance,
                    data.Value.AllowRemoteControl,
                    data.Value.MonitorId,
                    data.Value.GetSelectedApplicationsId());
            }
        }
Example #4
0
        private void btnGroupsAdd_Click(object sender, System.EventArgs e)
        {
            // show the form user
            FormGroup formGroup = new FormGroup(String.Empty);

            formGroup.Text = "Add Group";
            formGroup.SetMonitorList(groupPresenter.GetMonitorsList());
            formGroup.SetApplicationList(groupPresenter.GetApplicationList());
            if (formGroup.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                // add to database
                groupPresenter.AddGroup(
                    formGroup.GroupName,
                    formGroup.WholeDesktop,
                    formGroup.AllowMaintenance,
                    formGroup.AllowRemoteControl,
                    formGroup.MonitorId,
                    formGroup.GetSelectedApplicationsId());
            }
        }