Exemplo n.º 1
0
        /// <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();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <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);
                    }
                }
        }
Exemplo n.º 3
0
        /// <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);
                }
            }
        }
Exemplo n.º 4
0
        /// <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();
                            }
                        }
                    }
                }
        }