示例#1
0
        /// <summary>
        /// Добавляем канал
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void insert_channel_Click(object sender, EventArgs e)
        {
            InsertChannelForm ins = new InsertChannelForm();

            ins.Text = "Добавление канала";

            ins.Device = lastDevice;
            ins.Offset = lastOffset + lastSize;

            ins.DataSize = lastSize;

            if (ins.ShowDialog(this) == DialogResult.OK)
            {
                Parameter p = new Parameter();

                p.Device = ins.Device;
                p.Offset = ins.Offset;

                p.Size     = ins.DataSize;
                p.Position = app.Stock.GetFreeChannel();

                p.Description = ins.Comment;

                lastDevice = p.Device;
                lastOffset = p.Offset;

                lastSize = p.Size;

                app.Stock.InsertCondition(p);
                InsertCondition(p);
            }
        }
示例#2
0
        /// <summary>
        /// Редактируем канал
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void edit_channel_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in listViewChannels.SelectedItems)
            {
                if (item.Tag != null)
                {
                    if (item.Tag is Parameter)
                    {
                        Parameter parameter = item.Tag as Parameter;

                        InsertChannelForm ins = new InsertChannelForm();
                        ins.Text = "Редактирование канала";

                        ins.Device = parameter.Device;
                        ins.Offset = parameter.Offset;

                        ins.DataSize = parameter.Size;
                        ins.Comment = parameter.Description;

                        if (ins.ShowDialog(this) == DialogResult.OK)
                        {
                            parameter.Device = ins.Device;
                            parameter.Offset = ins.Offset;

                            parameter.Size = ins.DataSize;
                            parameter.Description = ins.Comment;

                            lastDevice = parameter.Device;
                            lastOffset = parameter.Offset;

                            lastSize = parameter.Size;

                            item.SubItems[1].Text = parameter.Device.ToString();

                            item.SubItems[2].Text = parameter.Offset.ToString();
                            item.SubItems[3].Text = parameter.Size.ToString();

                            item.SubItems[4].Text = parameter.Description;
                        }
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Редактируем канал
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void edit_channel_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in listViewChannels.SelectedItems)
            {
                if (item.Tag != null)
                {
                    if (item.Tag is Parameter)
                    {
                        Parameter parameter = item.Tag as Parameter;

                        InsertChannelForm ins = new InsertChannelForm();
                        ins.Text = "Редактирование канала";

                        ins.Device = parameter.Device;
                        ins.Offset = parameter.Offset;

                        ins.DataSize = parameter.Size;
                        ins.Comment  = parameter.Description;

                        if (ins.ShowDialog(this) == DialogResult.OK)
                        {
                            parameter.Device = ins.Device;
                            parameter.Offset = ins.Offset;

                            parameter.Size        = ins.DataSize;
                            parameter.Description = ins.Comment;

                            lastDevice = parameter.Device;
                            lastOffset = parameter.Offset;

                            lastSize = parameter.Size;

                            item.SubItems[1].Text = parameter.Device.ToString();

                            item.SubItems[2].Text = parameter.Offset.ToString();
                            item.SubItems[3].Text = parameter.Size.ToString();

                            item.SubItems[4].Text = parameter.Description;
                        }
                    }
                }
            }
        }
示例#4
0
        /// <summary>
        /// Добавляем канал
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void insert_channel_Click(object sender, EventArgs e)
        {
            InsertChannelForm ins = new InsertChannelForm();
            ins.Text = "Добавление канала";

            ins.Device = lastDevice;
            ins.Offset = lastOffset + lastSize;

            ins.DataSize = lastSize;

            if (ins.ShowDialog(this) == DialogResult.OK)
            {
                Parameter p = new Parameter();

                p.Device = ins.Device;
                p.Offset = ins.Offset;

                p.Size = ins.DataSize;
                p.Position = app.Stock.GetFreeChannel();

                p.Description = ins.Comment;

                lastDevice = p.Device;
                lastOffset = p.Offset;

                lastSize = p.Size;

                app.Stock.InsertCondition(p);
                InsertCondition(p);
            }
        }