예제 #1
0
        public void ShowSearchDlg(TaskMethodSimple tms, MethodSimpleElementFormula formula,
                                  MethodSimple method, SpectrView spv, string element_name, int el_index, int sel_col)
        {
            ElementIndex = el_index;
            ElementName  = element_name;
            TMS          = tms;
            Method       = method;
            Formula      = formula;
            Spv          = spv;
            SelectedCol  = sel_col;
            Sp           = spv.GetSpectr(0);
            if (Sp == null)
            {
                MessageBox.Show(MainForm.MForm, Common.MLS.Get(MLSConst, "Необходимо выбрать спектры по котором будет производится привязка к профилю..."),
                                Common.MLS.Get(MLSConst, "Предупреждение"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            btSearchStart.Text = Common.MLS.Get(MLSConst, MLSStartButtonText);
            Saved = new MemoryStream();
            BinaryWriter bw = new BinaryWriter(Saved);

            try
            {
                Formula.Save(bw);
            }
            catch (Exception ex)
            {
                Common.LogNoMsg(ex);
                MessageBox.Show(MainForm.MForm, Common.MLS.Get(MLSConst, "Нельзя подбирать линии для незаконченной формулы..."),
                                Common.MLS.Get(MLSConst, "Предупреждение"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (Formula.Formula.SeachBuffer != null)
            {
                MemoryStream ms  = new MemoryStream(Formula.Formula.SeachBuffer);
                BinaryReader br  = new BinaryReader(ms);
                int          ver = br.ReadInt32();
                if (ver == 1)
                {
                    int size = br.ReadInt32();
                    for (int i = 0; i < size; i++)
                    {
                        Results.Add(new CalcResult(br));
                    }
                    br.Close();
                    ReloadResultList();
                }
            }

            this.ShowDialog(MainForm.MForm);
        }
예제 #2
0
        public CheckedSpectrCollectionControl(DbFolder folder, TreeView sp_list,//CheckedListBox sp_list,
                                              SpectrView sp_view,
                                              ToolStripMenuItem bt_measuring_new_spmi,
                                              ToolStripMenuItem bt_remeas_spmi,
                                              ToolStripMenuItem bt_remove_spmi)
        {
            Folder             = folder;
            clSpList           = sp_list;
            sp_list.CheckBoxes = true;
            //clSpList.SelectedIndexChanged += new EventHandler(clSpList_SelectedIndexChanged);
            clSpList.AfterCheck += new TreeViewEventHandler(clSpList_AfterCheck);
            //clSpList.ItemCheck += new ItemCheckEventHandler(clSpList_ItemCheck);
            clSpList.AfterSelect += new TreeViewEventHandler(clSpList_AfterSelect);
            SpView = sp_view;

            /*if (bt_meas_new_sp != null)
             * {
             *  btMeasuringNewSpectr = bt_meas_new_sp;
             *  btMeasuringNewSpectr.Click += new EventHandler(btMeasuringNewSpectr_Click);
             * }*/
            if (bt_measuring_new_spmi != null)
            {
                //btMeasuringNewSpectr = bt_meas_new_sp;
                bt_measuring_new_spmi.Click += new EventHandler(btMeasuringNewSpectr_Click);
            }

            /*if (bt_remeas_sp != null)
             * {
             *  btReMeasuringSpectr = bt_remeas_sp;
             *  btReMeasuringSpectr.Click += new EventHandler(btReMeasuringSpectr_Click);
             * }*/
            if (bt_remeas_spmi != null)
            {
                //btReMeasuringSpectr = bt_rem eas_sp;
                bt_remeas_spmi.Click += new EventHandler(btReMeasuringSpectr_Click);
            }

            /*if (bt_remove != null)
             * {
             *  btRemoveSpectr = bt_remove;
             *  btRemoveSpectr.Click += new EventHandler(btRemoveSpectr_Click);
             * }*/
            if (bt_remove_spmi != null)
            {
                bt_remove_spmi.Click += new EventHandler(btRemoveSpectr_Click);
            }
            try
            {
                ReLoadList();
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }

            ContextMenu cm = new ContextMenu();
            //cm.MenuItems;
            MenuItem mi = new MenuItem(Common.MLS.Get(MLSConst, "Измерить новый спектр"));

            mi.Click += new EventHandler(btMeasuringNewSpectr_Click);
            cm.MenuItems.Add(mi);
            mi        = new MenuItem(Common.MLS.Get(MLSConst, "Перемерить спектр"));
            mi.Click += new EventHandler(btReMeasuringSpectr_Click);
            cm.MenuItems.Add(mi);
            mi        = new MenuItem(Common.MLS.Get(MLSConst, "Удалить спектр"));
            mi.Click += new EventHandler(btRemoveSpectr_Click);
            cm.MenuItems.Add(mi);

            cm.MenuItems.Add("-");

            mi        = new MenuItem(Common.MLS.Get(MLSConst, "Создать копию спектра"));
            mi.Click += new EventHandler(miCopySpectr_Click);
            cm.MenuItems.Add(mi);

            cm.MenuItems.Add("-");
            mi        = new MenuItem(Common.MLS.Get(MLSConst, "Создать папку"));
            mi.Click += new EventHandler(miAddFolder_Click);
            cm.MenuItems.Add(mi);
            mi        = new MenuItem(Common.MLS.Get(MLSConst, "Удалить папку"));
            mi.Click += new EventHandler(miRemoveFolder_Click);
            cm.MenuItems.Add(mi);

            clSpList.ContextMenu = cm;

            clSpList.MouseUp  += new MouseEventHandler(clSpList_MouseUp);
            clSpList.ImageList = MainForm.MForm.liCheckedTreeImages;
        }