コード例 #1
0
ファイル: IdealRashodForm.cs プロジェクト: slawer/sgt
        /// <summary>
        /// редактируем пару
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editCurrent_Click(object sender, EventArgs e)
        {
            if (p109 != null && p112 == null)
            {
                if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
                {
                    P0109.IdealFlowPair sel = listView1.SelectedItems[0].Tag as P0109.IdealFlowPair;
                    if (sel != null)
                    {
                        IdealPairForm frm = new IdealPairForm();

                        frm.Text = "Редактирование";

                        frm.textBoxFlow.Text    = sel.Flow.ToString();
                        frm.textBoxDiametr.Text = sel.Diameter.ToString();

                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            sel.Flow     = SgtApplication.ParseSingle(frm.textBoxFlow.Text);
                            sel.Diameter = SgtApplication.ParseSingle(frm.textBoxDiametr.Text);

                            listView1.SelectedItems[0].SubItems[1].Text = sel.Flow.ToString();
                            listView1.SelectedItems[0].SubItems[2].Text = sel.Diameter.ToString();
                        }
                    }
                }
            }
            else
            if (p112 != null && p109 == null)
            {
                if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
                {
                    P0112.IdealFlowPair sel = listView1.SelectedItems[0].Tag as P0112.IdealFlowPair;
                    if (sel != null)
                    {
                        IdealPairForm frm = new IdealPairForm();

                        frm.Text = "Редактирование";

                        frm.textBoxFlow.Text    = sel.Flow.ToString();
                        frm.textBoxDiametr.Text = sel.Diameter.ToString();

                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            sel.Flow     = SgtApplication.ParseSingle(frm.textBoxFlow.Text);
                            sel.Diameter = SgtApplication.ParseSingle(frm.textBoxDiametr.Text);

                            listView1.SelectedItems[0].SubItems[1].Text = sel.Flow.ToString();
                            listView1.SelectedItems[0].SubItems[2].Text = sel.Diameter.ToString();
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: IdealRashodForm.cs プロジェクト: slawer/sgt
        /// <summary>
        /// добавляем пару
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addNew_Click(object sender, EventArgs e)
        {
            if (p109 != null && p112 == null)
            {
                IdealPairForm frm = new IdealPairForm();
                frm.Text = "Добавление";

                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    float flow = SgtApplication.ParseSingle(frm.textBoxFlow.Text);
                    float diam = SgtApplication.ParseSingle(frm.textBoxDiametr.Text);

                    P0109.IdealFlowPair pair = new P0109.IdealFlowPair(diam, flow);
                    _app.Technology.P0109.InsertPair(pair);

                    ListViewItem item = new ListViewItem((listView1.Items.Count + 1).ToString());

                    ListViewItem.ListViewSubItem rashod   = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Flow));
                    ListViewItem.ListViewSubItem diameter = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Diameter));

                    item.SubItems.Add(rashod);
                    item.SubItems.Add(diameter);

                    item.Tag = pair;
                    listView1.Items.Add(item);
                }
            }
            else
            if (p112 != null && p109 == null)
            {
                IdealPairForm frm = new IdealPairForm();
                frm.Text = "Добавление";

                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    float flow = SgtApplication.ParseSingle(frm.textBoxFlow.Text);
                    float diam = SgtApplication.ParseSingle(frm.textBoxDiametr.Text);

                    P0112.IdealFlowPair pair = new P0112.IdealFlowPair(flow, diam);
                    _app.Technology.P0112.InsertPair(pair);

                    ListViewItem item = new ListViewItem((listView1.Items.Count + 1).ToString());

                    ListViewItem.ListViewSubItem rashod   = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Flow));
                    ListViewItem.ListViewSubItem diameter = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Diameter));

                    item.SubItems.Add(rashod);
                    item.SubItems.Add(diameter);

                    item.Tag = pair;
                    listView1.Items.Add(item);
                }
            }
        }
コード例 #3
0
ファイル: IdealRashodForm.cs プロジェクト: slawer/sgt
        /// <summary>
        /// добавляем пару
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addNew_Click(object sender, EventArgs e)
        {
            if (p109 != null && p112 == null)
            {
                IdealPairForm frm = new IdealPairForm();
                frm.Text = "Добавление";

                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    float flow = SgtApplication.ParseSingle(frm.textBoxFlow.Text);
                    float diam = SgtApplication.ParseSingle(frm.textBoxDiametr.Text);

                    P0109.IdealFlowPair pair = new P0109.IdealFlowPair(diam, flow);
                    _app.Technology.P0109.InsertPair(pair);

                    ListViewItem item = new ListViewItem((listView1.Items.Count + 1).ToString());

                    ListViewItem.ListViewSubItem rashod = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Flow));
                    ListViewItem.ListViewSubItem diameter = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Diameter));

                    item.SubItems.Add(rashod);
                    item.SubItems.Add(diameter);

                    item.Tag = pair;
                    listView1.Items.Add(item);
                }
            }
            else
                if (p112 != null && p109 == null)
                {
                    IdealPairForm frm = new IdealPairForm();
                    frm.Text = "Добавление";

                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        float flow = SgtApplication.ParseSingle(frm.textBoxFlow.Text);
                        float diam = SgtApplication.ParseSingle(frm.textBoxDiametr.Text);

                        P0112.IdealFlowPair pair = new P0112.IdealFlowPair(flow, diam);
                        _app.Technology.P0112.InsertPair(pair);

                        ListViewItem item = new ListViewItem((listView1.Items.Count + 1).ToString());

                        ListViewItem.ListViewSubItem rashod = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Flow));
                        ListViewItem.ListViewSubItem diameter = new ListViewItem.ListViewSubItem(item, string.Format("{0:F3}", pair.Diameter));

                        item.SubItems.Add(rashod);
                        item.SubItems.Add(diameter);

                        item.Tag = pair;
                        listView1.Items.Add(item);
                    }
                }
        }
コード例 #4
0
ファイル: IdealRashodForm.cs プロジェクト: slawer/sgt
        /// <summary>
        /// удаляем пару
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void removeCurrent_Click(object sender, EventArgs e)
        {
            if (p109 != null && p112 == null)
            {
                if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
                {
                    ListViewItem item = listView1.SelectedItems[0];
                    if (item != null)
                    {
                        P0109.IdealFlowPair selected_pair = item.Tag as P0109.IdealFlowPair;
                        if (selected_pair != null)
                        {
                            p109.RemovePair(selected_pair);
                            listView1.Items.Remove(item);

                            for (int i = 0; i < listView1.Items.Count; i++)
                            {
                                listView1.Items[i].Text = (i + 1).ToString();
                            }
                        }
                    }
                }
            }
            else
            if (p112 != null && p109 == null)
            {
                if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
                {
                    ListViewItem item = listView1.SelectedItems[0];
                    if (item != null)
                    {
                        P0112.IdealFlowPair selected_pair = item.Tag as P0112.IdealFlowPair;
                        if (selected_pair != null)
                        {
                            p112.RemovePair(selected_pair);
                            listView1.Items.Remove(item);

                            for (int i = 0; i < listView1.Items.Count; i++)
                            {
                                listView1.Items[i].Text = (i + 1).ToString();
                            }
                        }
                    }
                }
            }
        }