Example #1
0
        private List <String> GetSelectedIds(out List <GCNotification> associatedGCN)
        {
            List <String> ids = new List <string>();

            associatedGCN = new List <GCNotification>();

            Dictionary <string, GCNotification> selectionDico = new Dictionary <string, GCNotification>();

            foreach (ListViewItem item in lvGCNListGroup.SelectedItems)
            {
                EXListViewItem lvi = item as EXListViewItem;
                foreach (GCNotification gcn in _dicoItemGCs[lvi])
                {
                    if (!selectionDico.ContainsKey(gcn.id))
                    {
                        selectionDico.Add(gcn.id, gcn);
                    }
                }
            }

            foreach (var pair in selectionDico)
            {
                ids.Add(pair.Key);
                associatedGCN.Add(pair.Value);
            }
            return(ids);
        }
Example #2
0
        public AssociationBuilder(StartItem[] startItems)
        {
            InitializeComponent();

            this.Icon = SMOz.Properties.Resources.Application;

            installedPrograms = SMOz.Cleanup.InstalledProgramList.RetrieveProgramList();
            itemTags          = new Dictionary <EXListViewItem, StartItem>(startItems.Length);

            ComboBox comboBox = new ComboBox();

            comboBox.Items.Add("");
            foreach (string str in installedPrograms)
            {
                comboBox.Items.Add(str);
            }

            comboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
            comboBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;

            _associationList.Columns.Add(new ColumnHeader("Start Item"));
            _associationList.Columns.Add(new EXEditableColumnHeader("Program", comboBox));

            foreach (StartItem startItem in startItems)
            {
                EXListViewItem listItem = new EXListViewItem(startItem.Name);
                listItem.SubItems.Add(new EXListViewSubItem(startItem.Application));
                _associationList.Items.Add(listItem);
                itemTags.Add(listItem, startItem);
            }

            _associationList.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            _associationList.Columns[0].Width += 30;
            _associationList.Columns[1].Width  = _associationList.Width - _associationList.Columns[0].Width - 30;
        }
Example #3
0
        private void ListViewBing(PackageInfo packinfo)
        {
            //movie
            EXListViewItem item = new EXListViewItem(packinfo.Packagename);

            //添加第二列控件    上传路径
            EXControls.EXListViewSubItem serverpath = new EXControls.EXListViewSubItem();
            item.SubItems.Add(serverpath);
            //添加第三列控件   进度
            EXControlListViewSubItem cs = new EXControlListViewSubItem();
            ProgressBar b = new ProgressBar();

            b.Tag     = item;
            b.Maximum = 100;
            b.Value   = 100;
            item.SubItems.Add(cs);
            this.exListView1.AddControlToSubItem(b, cs);
            //添加第四列控件   状态
            EXControls.EXListViewSubItem status = new EXControls.EXListViewSubItem();
            item.SubItems.Add(status);
            //添加第五列控件   操作
            EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
            LinkLabel llbl = new LinkLabel();

            llbl.Text         = "上传";
            llbl.Tag          = cs;
            llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);
            item.SubItems.Add(cs1);
            this.exListView1.AddControlToSubItem(llbl, cs1);


            //conclusion
            //item.SubItems.Add(new EXBoolListViewSubItem(true));
            this.exListView1.Items.Add(item);
        }
Example #4
0
 private void _ignoreList_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         clickedItem = (EXListViewItem)_ignoreList.GetItemAt(e.X, e.Y);
     }
 }
Example #5
0
        //指令选择
        private void ComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cmBox = sender as ComboBox;

            if (cmBox.SelectedIndex < 0)
            {
                return;
            }

            for (int j = 0; j < exListView1.SelectedItems.Count; j++)
            {
                int i = exListView1.SelectedIndices[j];

                EXListViewItem itemName = exListView1.Items[i] as EXListViewItem;

                EXControlListViewSubItem itemTxtBox = itemName.SubItems[2] as EXControlListViewSubItem;

                TextBox txtBox = itemTxtBox.MyControl as TextBox;

                switch (cmBox.SelectedIndex)
                {
                case 0:
                    txtBox.Text = LINE_UNIT;
                    break;

                case 1:
                    txtBox.Text = ARC_UNIT;
                    break;

                default:
                    break;
                }
            }
        }
Example #6
0
        private void exListView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            labSum.Text = "选中" + exListView1.SelectedIndices.Count.ToString() + "条";
            try
            {
                for (int i = 0; i < exListView1.SelectedIndices.Count; i++)
                {
                    int            index    = exListView1.SelectedIndices[i];
                    EXListViewItem itemName = exListView1.Items[index] as EXListViewItem;

                    if (index + 1 == exListView1.Items.Count)
                    {
                        exListView1.BeginUpdate();

                        int lastIndex = Convert.ToInt32(itemName.Text) + 1;

                        m_exListViewItem = new EXListViewItem(lastIndex.ToString());

                        InitControls(m_exListViewItem);

                        exListView1.Items.Add(m_exListViewItem);

                        exListView1.EndUpdate();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #7
0
 private void _ignoreList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if ((_ignoreList.SelectedItems != null) && (_ignoreList.SelectedItems.Count >= 1))
     {
         clickedItem = (EXListViewItem)_ignoreList.SelectedItems[0];
     }
 }
Example #8
0
        private void ConfigEditor_Load(object sender, EventArgs e)
        {
            // Load columns & co
            elvConfigcfgeditor.Columns.Add(new EXColumnHeader("Name", 200));

            // Control textbox for edition
            txtbx           = new TextBox();
            txtbx.Visible   = false;
            txtbx.ForeColor = Color.Blue;
            elvConfigcfgeditor.Controls.Add(txtbx);
            txtbx.Leave    += new EventHandler(c_Leave);
            txtbx.KeyPress += new KeyPressEventHandler(txtbx_KeyPress);

            elvConfigcfgeditor.Columns.Add(new EXEditableColumnHeader("Value", txtbx, 400));

            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            foreach (KeyValueConfigurationElement keyValueElement  in config.AppSettings.Settings)
            {
                EXListViewItem item = new EXListViewItem(keyValueElement.Key);
                elvConfigcfgeditor.Items.Add(item);
                EXListViewSubItem subitem = new EXListViewSubItem(keyValueElement.Value);
                item.SubItems.Add(subitem);
            }
        }
Example #9
0
        private void PopListView()
        {
            _sListView.Items.Clear();
            _sListView.BeginUpdate();

            foreach (QuantifyMenu qmenu in _morbidityTest.QuantifyMenus)
            {
                foreach (QuantificationMetric qm in qmenu.QuantificationMetrics)
                {
                    EXListViewItem li = new EXListViewItem(qm.Product.ProductName)
                    {
                        Tag = qm
                    };

                    li.SubItems.Add(new EXListViewSubItem(qm.Product.BasicUnit));
                    li.SubItems.Add(new EXListViewSubItem(qm.UsageRate.ToString(), "U.Rate"));
                    li.SubItems.Add(new EXListViewSubItem(qm.QuantifyMenu.Title.Replace('_', ' ')));
                    li.SubItems.Add(new EXListViewSubItem(qm.CollectionSupplieAppliedTo, "Supplies"));

                    _sListView.Items.Add(li);
                }
            }

            _sListView.EndUpdate();
            lbtRemoveReagent.Enabled = false;
        }
Example #10
0
        public void initRows()
        {
            Manual_File[] uf = UpdateInfo.Manual_Files;
            //this.exListView1.ItemCheck
            ImageList il = new ImageList();

            il.ImageSize = new Size(1, 20);
            exListView1.SmallImageList = il;
            this.exListView1.BeginUpdate();
            for (int i = 0; i < uf.Length; i++)
            {
                EXListViewItem item = new EXListViewItem(i.ToString());
                item.SubItems.Add(new EXBoolListViewSubItem(false));
                item.SubItems.Add(uf[i].Name);
                item.SubItems.Add(uf[i].Content);


                EXControlListViewSubItem es = new EXControlListViewSubItem();
                LinkLabel bt = new LinkLabel();
                bt.Text         = "编辑";
                bt.Tag          = item;
                bt.LinkClicked += new LinkLabelLinkClickedEventHandler(bt_Click);
                item.SubItems.Add(es);
                item.SubItems.Add(uf[i].Fileurl);
                this.exListView1.AddControlToSubItem(bt, es);
                this.exListView1.Items.Add(item);
            }
            this.exListView1.EndUpdate();
        }
Example #11
0
        public Form1()
        {
            InitializeComponent();
            exListView1.Columns.Add(new EXEditableColumnHeader("Movie", 20));
            exListView1.Columns.Add(new EXColumnHeader("Progress", 120));
            exListView1.Columns.Add(new EXColumnHeader("Status", 80));

            for (int i = 0; i < 100; i++)
            {
                //movie
                EXListViewItem           item = new EXListViewItem(i.ToString());
                EXControlListViewSubItem cs   = new EXControlListViewSubItem();
                ProgressBar b = new ProgressBar();
                b.Tag     = item;
                b.Minimum = 0;
                b.Maximum = 100;
                b.Value   = 50;
                item.SubItems.Add(cs);
                exListView1.AddControlToSubItem(b, cs);
                EXControlListViewSubItem ss = new EXControlListViewSubItem();
                Label aaa = new Label();
                aaa.Text = "asdf";
                item.SubItems.Add(ss);
                exListView1.AddControlToSubItem(aaa, ss);
                exListView1.Items.Add(item);
            }
        }
        public delegate void UpdateTaskList(TaskInfo step);//声明一个更新主线程的委托

        //绑定工作人员卡和内镜卡
        public void AddTaskList(TaskInfo info)
        {
            try
            {
                EXListView iTaskList = TaskList[info.Group];
                if (iTaskList.InvokeRequired)
                {
                    UpdateTaskList updatedelegate = new UpdateTaskList(AddTaskList);
                    ParentForm.Invoke(updatedelegate, new object[] { info });
                }
                else
                {
                    iTaskList.BeginUpdate();

                    //movie
                    EXListViewItem item     = new EXListViewItem(info.Card);
                    string         cardname = "";
                    string         workName = info.CleanWorker;
                    if (Cardlist.ContainsKey(info.Card))
                    {
                        cardname = Cardlist[info.Card];
                    }
                    if (Cardlist.ContainsKey(info.CleanWorker))
                    {
                        workName = Cardlist[info.CleanWorker];
                    }
                    item.SubItems.Add(cardname);
                    item.SubItems.Add(workName);
                    item.SubItems.Add(info.errorInfo);
                    for (int i = 4; i < iTaskList.Columns.Count; i++)
                    {
                        EXControlListViewSubItem cs = new EXControlListViewSubItem();
                        SkinProgressBar          b  = new SkinProgressBar();
                        b.TextFormat = SkinProgressBar.TxtFormat.None;
                        b.Tag        = item;
                        b.Minimum    = 0;
                        b.Maximum    = 100;
                        b.Step       = 1;
                        item.SubItems.Add(cs);
                        iTaskList.AddControlToSubItem(b, cs);
                    }

                    iTaskList.Items.Add(item);

                    EXControlListViewSubItem subitem = item.SubItems[info.Step + 3] as EXControlListViewSubItem;
                    SkinProgressBar          p       = subitem.MyControl as SkinProgressBar;
                    p.Maximum = info.Time * 10;
                    Thread th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod));
                    th.IsBackground = true;
                    th.Start(p);

                    iTaskList.EndUpdate();
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(Exception), ex);
            }
        }
Example #13
0
        private void method_0()
        {
            IRasterBandCollection raster = this.irasterLayer_0.Raster as IRasterBandCollection;

            if (raster.Count != this.irasterLayer_0.BandCount)
            {
                IName dataSourceName = (this.irasterLayer_0 as IDataLayer2).DataSourceName;
                if (dataSourceName != null)
                {
                    raster = dataSourceName.Open() as IRasterBandCollection;
                }
            }
            IEnumRasterBand bands = raster.Bands;

            bands.Reset();
            for (IRasterBand band2 = bands.Next(); band2 != null; band2 = bands.Next())
            {
                this.comboBox_0.Items.Add(new BandWrap(band2));
            }
            string[]       strArray = new string[] { "红色", raster.Item(this.irasterRGBRenderer_0.RedBandIndex).Bandname };
            EXListViewItem item     = new EXListViewItem(strArray);

            item.SubItems.Add(new EXBoolListViewSubItem(this.irasterRGBRenderer_0.UseRedBand));
            this.exListView1.Items.Add(item);
            strArray[0] = "绿色";
            strArray[1] = raster.Item(this.irasterRGBRenderer_0.GreenBandIndex).Bandname;
            item        = new EXListViewItem(strArray);
            item.SubItems.Add(new EXBoolListViewSubItem(this.irasterRGBRenderer_0.UseGreenBand));
            this.exListView1.Items.Add(item);
            strArray[0] = "蓝色";
            strArray[1] = raster.Item(this.irasterRGBRenderer_0.BlueBandIndex).Bandname;
            item        = new EXListViewItem(strArray);
            item.SubItems.Add(new EXBoolListViewSubItem(this.irasterRGBRenderer_0.UseBlueBand));
            this.exListView1.Items.Add(item);
            IColor backgroundColor = (this.irasterRGBRenderer_0 as IRasterStretch2).BackgroundColor;

            if (backgroundColor != null)
            {
                this.method_1(this.colorEdit1, backgroundColor);
            }
            backgroundColor = (this.irasterRGBRenderer_0 as IRasterDisplayProps).NoDataColor;
            if (backgroundColor != null)
            {
                this.method_1(this.colorEdit2, backgroundColor);
            }
            object backgroundValue = (this.irasterRGBRenderer_0 as IRasterStretch2).BackgroundValue;

            this.chkShowBackground.Checked = (this.irasterRGBRenderer_0 as IRasterStretch2).Background;
            this.txtBackgroundR.Enabled    = this.chkShowBackground.Checked;
            this.txtBackgroundG.Enabled    = this.chkShowBackground.Checked;
            this.txtBackgroundB.Enabled    = this.chkShowBackground.Checked;
            double[] numArray = backgroundValue as double[];
            this.txtBackgroundR.Text = numArray[0].ToString();
            this.txtBackgroundG.Text = numArray[1].ToString();
            this.txtBackgroundB.Text = numArray[2].ToString();
        }
Example #14
0
        private void BindCD4BloodSample()
        {
            InitCD4ListView();
            foreach (ProtocolPanel pp in _protocol.ProtocolPanels)
            {
                _cd4Panel = pp;
                for (int i = 1; i <= 4; i++)
                {
                    EXListViewItem li = new EXListViewItem(GetRowTitle(i))
                    {
                        Tag = i
                    };

                    for (int m = 1; m <= 12; m++)
                    {
                        if (i == 1)
                        {
                            li.SubItems.Add(new EXListViewSubItem(pp.AdultArtTestGivenInMonth(m).ToString(), m));
                        }
                        else if (i == 2)
                        {
                            li.SubItems.Add(new EXListViewSubItem(pp.PediatricArtTestGivenInMonth(m).ToString(), m));
                        }
                        else if (i == 3)
                        {
                            li.SubItems.Add(new EXListViewSubItem(pp.AdultPreArtTestGivenInMonth(m).ToString(), m));
                        }
                        else
                        {
                            li.SubItems.Add(new EXListViewSubItem(pp.PediatricPreArtTestGivenInMonth(m).ToString(), m));
                        }
                    }

                    if (i == 1)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pp.AITTestperYear.ToString(), 13));
                    }
                    else if (i == 2)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pp.PITTestperYear.ToString(), 13));
                    }
                    else if (i == 3)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pp.APARTestperYear.ToString(), 13));
                    }
                    else if (i == 4)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pp.PPARTTestperYear.ToString(), 13));
                    }

                    _cd4ListView.Items.Add(li);
                }
                break;
            }
        }
Example #15
0
        public static EXListViewItem CategoryItemToListItem(CategoryItem item, Category category, ListViewGroup group)
        {
            EXListViewItem newItem = new EXListViewItem(item.Value);

            newItem.SubItems.Add(new EXListViewSubItem(item.Type.ToString()));
            newItem.Name    = item.Value;
            newItem.TagData = item;
            if (category != null)
            {
                newItem.SubItems.Add(new EXListViewSubItem(category.Name));
            }
            if (group != null)
            {
                newItem.Group = group;
            }
            return(newItem);
        }
Example #16
0
        private void _ok_Click(object sender, EventArgs e)
        {
            if (User.Settings.Instance.ScanLocalPath != lbLocalDir.Checked)
            {
                this.needReScanning = true;
            }
            if (User.Settings.Instance.ScanUserPath != lbUserDir.Checked)
            {
                this.needReScanning = true;
            }

            if (this.needReScanning)
            {
                if (MessageBox.Show("Due to the changes you made, it is necessary to reload the Start Menu.\nUnsaved work will be lost. Continue?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                {
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }

            if (_ignoreList.Items.Count > 0)
            {
                EXListViewItem[] items = new EXListViewItem[_ignoreList.Items.Count];
                for (int i = 0; i < _ignoreList.Items.Count; i++)
                {
                    items[i] = _ignoreList.Items[i] as EXListViewItem;
                }
                TemplateEditor.PersistItemChanges(items);
            }

            string[] addtPaths = new string[lstAddtPaths.Items.Count];
            for (int i = 0; i < lstAddtPaths.Items.Count; i++)
            {
                addtPaths[i] = lstAddtPaths.Items[i].Text;
                if (!addtPaths[i].EndsWith(Path.DirectorySeparatorChar.ToString()))
                {
                    addtPaths[i] += Path.DirectorySeparatorChar;
                }
            }

            User.Settings.Instance.AdditionalPaths = addtPaths;
            User.Settings.Instance.ScanLocalPath   = lbLocalDir.Checked;
            User.Settings.Instance.ScanUserPath    = lbUserDir.Checked;
            User.Settings.Save();
        }
Example #17
0
        private void ListViewBing(PackageInfo packinfo)
        {
            //添加第二列控件    更新包名称     item[0]
            EXListViewItem item = new EXListViewItem(packinfo.Packagename);

            //添加第二列控件    上传路径       item[1]
            EXControls.EXListViewSubItem serverpath = new EXControls.EXListViewSubItem();
            //添加第三列控件   进度            item[2]
            EXControlListViewSubItem cs = new EXControlListViewSubItem();
            ProgressBar b = new ProgressBar();

            b.Tag = item;
            //添加第四列控件   状态            item[3]
            EXControls.EXListViewSubItem status = new EXControls.EXListViewSubItem();
            //添加第五列控件   操作             item[4]
            EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
            LinkLabel llbl = new LinkLabel();

            llbl.Tag          = cs;
            llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);

            if (!string.IsNullOrEmpty(packinfo.PubPath) && CommonConst.PACKSTATE_YiFaBu.Equals(packinfo.State))
            {
                serverpath.Text = packinfo.PubPath;
                status.Text     = "已上传";
                b.Maximum       = 100;
                b.Value         = 100;
                llbl.Text       = "重传";
            }
            else
            {
                status.Text = "未上传";
                llbl.Text   = "上传";
            }
            item.SubItems.Add(serverpath);
            item.SubItems.Add(cs);
            item.SubItems.Add(status);
            item.SubItems.Add(cs1);
            item.SubItems.Add(packinfo.Id.ToString());
            item.SubItems.Add(packinfo.Packagepath);
            item.Tag = "true";          //默认是 确认上传
            this.exListView1.AddControlToSubItem(b, cs);
            this.exListView1.AddControlToSubItem(llbl, cs1);
            this.exListView1.Items.Add(item);
        }
        private void PopListView()
        {
            _sListView.Items.Clear();
            _sListView.BeginUpdate();

            foreach (ImportedTestingArea ta in _listOfImportedTA.Values)
            {
                EXListViewItem li = new EXListViewItem(ta.AreaName)
                {
                    Tag = ta
                };
                li.SubItems.Add(new EXListViewSubItem("---Select Testing Area---", "Testing Area"));

                _sListView.Items.Add(li);
            }

            _sListView.EndUpdate();
        }
        public static void Create(int row)
        {
            _lv.Items.Clear();
            _process.ForEach(item =>
            {
                _lv.Controls.Remove(item);
            });

            _process.Clear();

            for (int i = 0; i < row; i++)
            {
                EXListViewItem           lvi = new EXListViewItem();
                EXControlListViewSubItem cs  = new EXControlListViewSubItem();


                ProgressBar pb = new ProgressBar();

                lvi.SubItems[0].Text = "Đang lấy link.";
                //lvi.SubItems.Add("");
                //lvi.SubItems.Add("0");
                //lvi.SubItems.Add("");
                //lvi.SubItems.Add("");

                _lv.Items.Add(lvi);

                //var s = lvi.Bounds;

                //Rectangle r = lvi.SubItems[1].Bounds;
                //pb.SetBounds(r.X, r.Y - 2, r.Width, r.Height - 4);


                pb.Minimum = 0;
                pb.Maximum = 100;
                pb.Value   = 0;
                pb.Step    = 1;
                lvi.SubItems.Add(cs);
                _lv.AddControlToSubItem(pb, cs);

                // _lv.Controls.Add(pb);
                _process.Add(pb);
            }
        }
Example #20
0
        private void BindOtherSymptom()
        {
            InitOtherListView();

            //OtherTestNameEnum[] tname = LqtUtil.EnumToArray<OtherTestNameEnum>();
            var results = DataRepository.GetTestByPlatform(ClassOfMorbidityTestEnum.OtherTest.ToString());

            for (int i = 1; i <= 4; i++)
            {
                EXListViewItem li = new EXListViewItem(GetRowTitle(i))
                {
                    Tag = i
                };

                //for (int m = 0; m < tname.Length; m++)
                foreach (Test t in results)
                {
                    PSymptomDirectedTest pdt = _protocol.GetSymptomDirectedTestByTestId(t.Id);
                    if (pdt != null)
                    {
                        if (i == 1)
                        {
                            li.SubItems.Add(new EXListViewSubItem(pdt.AdultInTreatmeant.ToString(), t.Id));
                        }
                        else if (i == 2)
                        {
                            li.SubItems.Add(new EXListViewSubItem(pdt.PediatricInTreatmeant.ToString(), t.Id));
                        }
                        else if (i == 3)
                        {
                            li.SubItems.Add(new EXListViewSubItem(pdt.AdultPreART.ToString(), t.Id));
                        }
                        else
                        {
                            li.SubItems.Add(new EXListViewSubItem(pdt.PediatricPreART.ToString(), t.Id));
                        }
                    }
                }

                _othListView.Items.Add(li);
            }
        }
Example #21
0
        private void PopTests()
        {
            _sListView.BeginUpdate();
            _sListView.Items.Clear();

            foreach (QuantificationMetric qm in DataRepository.GetAllQuantificationMetricByClass(_filiterBy.ToString()))
            {
                EXListViewItem li = new EXListViewItem(qm.Product.ProductName)
                {
                    Tag = qm
                };

                li.SubItems.Add(new EXListViewSubItem(qm.Product.BasicUnit));
                li.SubItems.Add(new EXListViewSubItem(qm.UsageRate.ToString(), "U.Rate"));
                li.SubItems.Add(new EXListViewSubItem(qm.QuantifyMenu.Title));
                //li.SubItems.Add(new EXListViewSubItem(qm.CollectionSupplieAppliedTo, "Supplies"));

                _sListView.Items.Add(li);
            }
            _sListView.EndUpdate();
        }
Example #22
0
        public void bt_Click(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel      ll      = sender as LinkLabel;
            EXListViewItem ev      = ll.Tag as EXListViewItem;
            string         fileurl = this.Parent.Tag as string + @"\" + ev.SubItems[5].Text;

            XmlPad.XmlEditor xe = new XmlPad.XmlEditor();
            xe._content = ev.SubItems[3].Text;
            if (!xe.LoadFile(fileurl))
            {
                xe.Close();
                xe.Dispose();
            }
            else
            {
                xe.ShowDialog();
                EXBoolListViewSubItem booes = ev.SubItems[1] as EXBoolListViewSubItem;
                booes.BoolValue = true;
                this.exListView1.Refresh();
            }
        }
Example #23
0
        public MainForm()
        {
            InitializeComponent();
            fSyncContext    = SynchronizationContext.Current;
            fCurrentDigest  = new Digest();
            fPreviousDigest = new Digest();

            fProcessorCores = FCCore.GetProcessorsCount();
            fCoreBusy       = new bool[fProcessorCores];
            Array.Clear(fCoreBusy, 0, fProcessorCores);

            Text = "ProcessorsCount: " + fProcessorCores;

            lvFolders.Columns.Add("Folder", 300);

            exListView1.Columns.Add("File", 200);
            exListView1.Columns.Add("Progress", 200);

            lvFiles.Columns.Add("File", 400);
            lvFiles.Columns.Add("Hash", 300);
            lvFiles.Columns.Add("Type", 200);

            fListItems    = new EXListViewItem[fProcessorCores];
            fProgressBars = new ProgressBar[fProcessorCores];
            for (int i = 0; i < fProcessorCores; i++)
            {
                EXListViewItem           item = new EXListViewItem("Item " + i);
                EXControlListViewSubItem cs   = new EXControlListViewSubItem();
                ProgressBar b = new ProgressBar();
                b.Minimum = 0;
                b.Maximum = 100;
                b.Step    = 1;
                item.SubItems.Add(cs);
                exListView1.AddControlToSubItem(b, cs);
                exListView1.Items.Add(item);

                fListItems[i]    = item;
                fProgressBars[i] = b;
            }
        }
Example #24
0
        private void InitControls(EXListViewItem item)
        {
            EXControlListViewSubItem itemcBox = new EXControlListViewSubItem();
            ComboBox cbBox = new ComboBox();

            cbBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            cbBox.SelectedIndexChanged += ComboBox1_SelectedIndexChanged;
            cbBox.Items.Add("直线插补");
            cbBox.Items.Add("圆弧插补");
            cbBox.SelectedIndex = 0;

            EXControlListViewSubItem itemText = new EXControlListViewSubItem();
            TextBox textBox = new TextBox();

            EXControlListViewSubItem itemLaser = new EXControlListViewSubItem();
            Button btnLaser = new Button();

            btnLaser.Click   += Button_Click;
            btnLaser.AutoSize = true;
            btnLaser.Text     = "OFF";

            EXControlListViewSubItem itemDelay = new EXControlListViewSubItem();
            NumericUpDown            delayTime = new NumericUpDown();

            delayTime.Maximum   = 10000;
            delayTime.Minimum   = 0;
            delayTime.Value     = 0;
            delayTime.TextAlign = HorizontalAlignment.Right;

            exListView1.AddControlToSubItem(cbBox, itemcBox);
            exListView1.AddControlToSubItem(textBox, itemText);
            exListView1.AddControlToSubItem(btnLaser, itemLaser);
            exListView1.AddControlToSubItem(delayTime, itemDelay);

            item.SubItems.Add(itemcBox);
            item.SubItems.Add(itemText);
            item.SubItems.Add(itemLaser);
            item.SubItems.Add(itemDelay);
        }
Example #25
0
        private void BindOtherSymptom()
        {
            InitOtherListView();

            OtherTestNameEnum[] tname = LqtUtil.EnumToArray <OtherTestNameEnum>();
            for (int i = 1; i <= 4; i++)
            {
                EXListViewItem li = new EXListViewItem(GetRowTitle(i))
                {
                    Tag = i
                };

                for (int m = 0; m < tname.Length; m++)
                {
                    PSymptomDirectedTest pdt = _protocol.GetSymptomDirectedTestByTestName(tname[m]);
                    if (i == 1)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pdt.AdultInTreatmeant.ToString(), tname[m]));
                    }
                    else if (i == 2)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pdt.PediatricInTreatmeant.ToString(), tname[m]));
                    }
                    else if (i == 3)
                    {
                        li.SubItems.Add(new EXListViewSubItem(pdt.AdultPreART.ToString(), tname[m]));
                    }
                    else
                    {
                        li.SubItems.Add(new EXListViewSubItem(pdt.PediatricPreART.ToString(), tname[m]));
                    }
                }

                _othListView.Items.Add(li);
            }
        }
Example #26
0
        private void PopGeneralQM()
        {
            _sListView.BeginUpdate();
            _sListView.Items.Clear();

            foreach (QuantifyMenu qmenu in _qMenus)
            {
                foreach (QuantificationMetric qm in qmenu.QuantificationMetrics)
                {
                    EXListViewItem li = new EXListViewItem(qm.Product.ProductName)
                    {
                        Tag = qm
                    };

                    li.SubItems.Add(new EXListViewSubItem(qm.Product.BasicUnit));
                    li.SubItems.Add(new EXListViewSubItem(qm.UsageRate.ToString(), "U.Rate"));
                    li.SubItems.Add(new EXListViewSubItem(qm.QuantifyMenu.DisplayTitle));
                    li.SubItems.Add(new EXListViewSubItem(qm.CollectionSupplieAppliedTo, "Supplies"));

                    _sListView.Items.Add(li);
                }
            }
            _sListView.EndUpdate();
        }
Example #27
0
        void Button2Click(object sender, EventArgs e)
        {
            // Supprime la sélection
            try
            {
                _daddy._ThreadProgressBarTitle = _daddy.GetTranslator().GetString("PQBtnDelete");
                _daddy.CreateThreadProgressBar();

                // On va parcourir chaque PQ, ouvrir sa page et poster la suppression
                for (int i = 0; i < lvGCNGrid.Items.Count; i++)
                {
                    EXListViewItem lvi = (EXListViewItem)(lvGCNGrid.Items[i]);

                    EXBoolListViewSubItem svi = lvi.SubItems[1] as EXBoolListViewSubItem;
                    if (svi != null)
                    {
                        if (svi.BoolValue == true)
                        {
                            String guid = lvi.MyValue;
                            guid = "https://www.geocaching.com/pocket/gcquery.aspx?guid=" + guid;
                            PQDownloadHMI.DeletePQ(_daddy, guid);
                        }
                    }
                }

                // On rafraichit
                InitPQs();

                _daddy.KillThreadProgressBar();
            }
            catch (Exception ex)
            {
                _daddy.ShowException("", _daddy.GetTranslator().GetString("checkPQToolStripMenuItem"), ex);
                _daddy.KillThreadProgressBar();
            }
        }
Example #28
0
	private void InitializeComponent() {
		//imglst_genre
		ImageList imglst_genre = new ImageList();
		imglst_genre.ColorDepth = ColorDepth.Depth32Bit;
		imglst_genre.Images.Add(Image.FromFile("music.png"));
		imglst_genre.Images.Add(Image.FromFile("love.png"));
		imglst_genre.Images.Add(Image.FromFile("comedy.png"));
		imglst_genre.Images.Add(Image.FromFile("drama.png"));
		imglst_genre.Images.Add(Image.FromFile("horror.ico"));
		imglst_genre.Images.Add(Image.FromFile("family.ico"));
		//excmbx_genre
		EXComboBox excmbx_genre = new EXComboBox();
		excmbx_genre.DropDownStyle = ComboBoxStyle.DropDownList;
		excmbx_genre.MyHighlightBrush = Brushes.Goldenrod;
		excmbx_genre.ItemHeight = 20;
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[0], "Music"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[1], "Romantic"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[2], "Comedy"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[3], "Drama"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[4], "Horror"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[5], "Family"));
		excmbx_genre.Items.Add(new EXComboBox.EXMultipleImagesItem(new ArrayList(new object[] {Image.FromFile("love.png"), Image.FromFile("comedy.png")}), "Romantic comedy"));
		//excmbx_rate
		EXComboBox excmbx_rate = new EXComboBox();
		excmbx_rate.MyHighlightBrush = Brushes.Goldenrod;
		excmbx_rate.DropDownStyle = ComboBoxStyle.DropDownList;
		ImageList imglst_rate = new ImageList();
		imglst_rate.ColorDepth = ColorDepth.Depth32Bit;
		imglst_rate.Images.Add(Image.FromFile("rate.png"));
		for (int i = 1; i < 6; i++) {
			ArrayList _arlst1 = new ArrayList();
			for (int j = 0; j < i; j++) {
				_arlst1.Add(imglst_rate.Images[0]);
			}
			excmbx_rate.Items.Add(new EXComboBox.EXMultipleImagesItem("", _arlst1, i.ToString()));
		}
		//lstv
		lstv = new EXListView();
		lstv.MySortBrush = SystemBrushes.ControlLight;
		lstv.MyHighlightBrush = Brushes.Goldenrod;
		lstv.GridLines = true;
		lstv.Location = new Point(10, 40);
		lstv.Size = new Size(500, 400);
		lstv.ControlPadding = 4;
		lstv.MouseMove += new MouseEventHandler(lstv_MouseMove);
		lstv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
		//add SmallImageList to ListView - images will be shown in ColumnHeaders
		ImageList colimglst = new ImageList();
		colimglst.Images.Add("down", Image.FromFile("down.png"));
		colimglst.Images.Add("up", Image.FromFile("up.png"));
		colimglst.ColorDepth = ColorDepth.Depth32Bit;
		colimglst.ImageSize = new Size(20, 20); // this will affect the row height
		lstv.SmallImageList = colimglst;
		//add columns and items
		lstv.Columns.Add(new EXEditableColumnHeader("Movie", 20));
		lstv.Columns.Add(new EXColumnHeader("Progress", 120));
		lstv.Columns.Add(new EXEditableColumnHeader("Genre", excmbx_genre, 60));
		lstv.Columns.Add(new EXEditableColumnHeader("Rate", excmbx_rate, 100));
		lstv.Columns.Add(new EXColumnHeader("Status", 80));
		EXBoolColumnHeader boolcol = new EXBoolColumnHeader("Conclusion", 80);
		boolcol.Editable = true;
		boolcol.TrueImage = Image.FromFile("true.png");
		boolcol.FalseImage = Image.FromFile("false.png");
		lstv.Columns.Add(boolcol);
		lstv.BeginUpdate();
		for (int i = 0; i < 100; i++) {
			//movie
			EXListViewItem item = new EXListViewItem(i.ToString());
			EXControlListViewSubItem cs = new EXControlListViewSubItem();
			ProgressBar b = new ProgressBar();
			b.Tag = item;
			b.Minimum = 0;
			b.Maximum = 1000;
			b.Step = 1;
			item.SubItems.Add(cs);
			lstv.AddControlToSubItem(b, cs);
			//genre
			item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] {imglst_genre.Images[1], imglst_genre.Images[2]}), "Romantic comedy"));
			//rate
			item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] {imglst_rate.Images[0]}), "1"));
			//cancel and resume
			EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
			LinkLabel llbl = new LinkLabel();
			llbl.Text = "Start";
			llbl.Tag = cs;
			llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);
			item.SubItems.Add(cs1);
			lstv.AddControlToSubItem(llbl, cs1);
			//conclusion
			item.SubItems.Add(new EXBoolListViewSubItem(true));
			lstv.Items.Add(item);
		}
		lstv.EndUpdate();
		//statusstrip1
		statusstrip1.Items.AddRange(new ToolStripItem[] {toolstripstatuslabel1});
		//btn
		btn.Location = new Point(10, 450);
		btn.Text = "Remove Control";
		btn.AutoSize = true;
		btn.Click += new EventHandler(btn_Click);
		//btn2
		btn2.Location = new Point(btn.Right + 20, 450);
		btn2.Text = "Remove Image";
		btn2.AutoSize = true;
		btn2.Click += new EventHandler(btn2_Click);
		//this
		this.ClientSize = new Size(520, 510);
		this.Controls.Add(statusstrip1);
		Label lbl = new Label();
		lbl.Text = "Doubleclick on the subitems to edit...";
		lbl.Bounds = new Rectangle(10, 10, 480, 20);
		this.Controls.Add(lbl);
		this.Controls.Add(lstv);
		this.Controls.Add(btn);
		this.Controls.Add(btn2);
	}
Example #29
0
        public void Apply()
        {
            try
            {
                for (int i = 0; i < this.exListView1.Items.Count; i++)
                {
                    EXListViewItem item = this.exListView1.Items[i] as EXListViewItem;
                    string         text = item.SubItems[1].Text;
                    int            num2 = 0;
                    int            num3 = 0;
                    while (num3 < this.comboBox_0.Items.Count)
                    {
                        if (text == this.comboBox_0.Items[num3].ToString())
                        {
                            goto Label_0078;
                        }
                        num3++;
                    }
                    goto Label_007B;
Label_0078:
                    num2 = num3;
Label_007B:
                    if (i == 0)
                    {
                        this.irasterRGBRenderer_0.RedBandIndex = num2;
                        this.irasterRGBRenderer_0.UseRedBand   = (item.SubItems[2] as EXBoolListViewSubItem).BoolValue;
                    }
                    else if (i == 1)
                    {
                        this.irasterRGBRenderer_0.GreenBandIndex = num2;
                        this.irasterRGBRenderer_0.UseGreenBand   = (item.SubItems[2] as EXBoolListViewSubItem).BoolValue;
                    }
                    else
                    {
                        this.irasterRGBRenderer_0.BlueBandIndex = num2;
                        this.irasterRGBRenderer_0.UseBlueBand   = (item.SubItems[2] as EXBoolListViewSubItem).BoolValue;
                    }
                }
                if (this.chkShowBackground.Checked)
                {
                    try
                    {
                        double[] numArray = new double[]
                        {
                            double.Parse(this.txtBackgroundR.Text), double.Parse(this.txtBackgroundG.Text),
                            double.Parse(this.txtBackgroundB.Text)
                        };
                        (this.irasterRGBRenderer_0 as IRasterStretch2).BackgroundValue = numArray;
                    }
                    catch
                    {
                    }
                }
                IObjectCopy        copy      = new ObjectCopyClass();
                IRasterRGBRenderer renderer1 = copy.Copy(this.irasterRGBRenderer_0) as IRasterRGBRenderer;
                this.irasterLayer_0.Renderer = this.irasterRGBRenderer_0 as IRasterRenderer;
            }
            catch (Exception)
            {
            }
        }
Example #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="daddy"></param>
        public NotificationCreation(MainWindow daddy)
        {
            _daddy      = daddy;
            _sErrTitle  = _daddy.GetTranslator().GetString("Error");
            _sErrFormat = _daddy.GetTranslator().GetString("ErrWrongParameter");

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled())
            {
                return;
            }

            btnGCNMap.Image = _daddy.GetImageSized("Earth");
            _daddy._cacheDetail._gmap.ControlTextLatLon = tbGCNCenter;
            tbGCNCenter.TextChanged += new System.EventHandler(this.txtCoord_TextChanged);
            tbGCNCenter.Text         = _daddy.HomeLat.ToString() + " " + _daddy.HomeLon.ToString();
            this.Text         = _daddy.GetTranslator().GetString("createpublishnotifications");
            lblGCNRadius.Text = _daddy.GetTranslator().GetString("FTFDistance");
            lblGCNCentre.Text = _daddy.GetTranslator().GetString("ParamCenterLatLon");
            lblGCNEmail.Text  = _daddy.GetTranslator().GetString("FTFEmails");
            lblGCNGrid.Text   = _daddy.GetTranslator().GetString("FTFCacheTypes");
            lblGCNNom.Text    = _daddy.GetTranslator().GetString("FTFName");
            btnGCNCancel.Text = _daddy.GetTranslator().GetString("BtnCancel");
            btnGCNCreate.Text = _daddy.GetTranslator().GetString("BtnOK");

            daddy.UpdateHttpDefaultWebProxy();
            String post_response = "";
            // On checke que les L/MDP soient corrects
            // Et on récupère les cookies au passage
            CookieContainer cookieJar = daddy.CheckGCAccount(true, false);

            if (cookieJar == null)
            {
                return;
            }

            // Pour récupérer les emails
            String         url        = "https://www.geocaching.com/notify/edit.aspx";
            HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);

            objRequest.Proxy           = daddy.GetProxy(); // Là encore, on peut virer le proxy si non utilisé (NULL)
            objRequest.CookieContainer = cookieJar;        // surtout récupérer le container de cookie qui est maintenant renseigné avec le cookie d'authentification
            HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();

            using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
            {
                post_response = responseStream.ReadToEnd();
                responseStream.Close();
            }
            if (NotificationsManager.CheckWarningMessage(_daddy, post_response))
            {
                // Shit
            }

            List <String> lsemails = new List <string>();
            String        email    = "";
            String        mails    = MyTools.GetSnippetFromText("ctl00$ContentBody$LogNotify$ddlAltEmails", "select>", post_response);

            lsemails = MyTools.GetSnippetsFromText("value=\"", "\">", mails);
            if (lsemails.Count != 0)
            {
                email = lsemails[0];
            }
            cbGCNEmails.Items.AddRange(lsemails.ToArray());
            if (cbGCNEmails.Items.Count != 0)
            {
                cbGCNEmails.SelectedIndex = 0;
            }
            else
            {
                cbGCNEmails.Visible = false;
                lblGCNEmail.Visible = false;
            }

            // List of cache type (to associate with list of int)
            listOfCacheTypes   = new List <string>(new String[] { "Earthcache", "Event Cache", "Cache In Trash Out Event", "Giga-Event Cache", "Mega-Event Cache", "Letterbox Hybrid", "Multi-cache", "Traditional Cache", "Unknown Cache", "Wherigo Cache", "Virtual Cache" }); // BCR 20170825
            listOfCacheTypesId = new List <int>(new int[] { 137, 6, 13, 7005, 453, 5, 3, 2, 8, 1858, 4 });                                                                                                                                                                       // BCR 20170825

            //Matrix
            listOfAlloweKindPerCacheType = new List <Tuple <String, List <int> > >();        // BCR 20170825
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Found it", new List <int>(new int[] { 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Retract Listing", new List <int>(new int[] { 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Didn't find it", new List <int>(new int[] { 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Temporarily Disable Listing", new List <int>(new int[] { 8, 10, 10, 10, 9, 8, 8, 8, 8, 8, 8 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Write note", new List <int>(new int[] { 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Enable Listing", new List <int>(new int[] { 9, 11, 11, 11, 10, 9, 9, 9, 9, 9, 9 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Archive", new List <int>(new int[] { 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Update Coordinates", new List <int>(new int[] { 10, 9, 9, 9, 11, 10, 10, 10, 10, 10, 10 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Needs Archived", new List <int>(new int[] { 4, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Needs Maintenance", new List <int>(new int[] { 11, -1, -1, -1, 12, 11, 11, 11, 11, 11, 11 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Unarchive", new List <int>(new int[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Owner Maintenance", new List <int>(new int[] { 12, -1, -1, -1, -1, 12, 12, 12, 12, 12, 12 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Publish Listing", new List <int>(new int[] { 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Announcement", new List <int>(new int[] { -1, 6, 6, 6, 6, -1, -1, -1, -1, -1, -1 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Will Attend", new List <int>(new int[] { -1, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1 })));
            listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Attended", new List <int>(new int[] { -1, 4, 4, 4, 4, -1, -1, -1, -1, -1, -1 })));

            // Create listview
            lvGCNGrid.HeaderStyle = ColumnHeaderStyle.None;
            ImageList imglist = new ImageList();

            imglist.ColorDepth = ColorDepth.Depth32Bit;
            imglist.ImageSize  = new Size(20, 20); // this will affect the row height
            imglist.Images.Add(_daddy.GetImageSized("Fail"));
            lvGCNGrid.SmallImageList   = imglist;
            lvGCNGrid.MouseClick      += new MouseEventHandler(lstv_MouseClick);
            lvGCNGrid.FullRowSelect    = true;
            lvGCNGrid.MyHighlightBrush = new SolidBrush(Color.Transparent);
            lvGCNGrid.MySelectBrush    = new SolidBrush(Color.Transparent);

            // Create columns
            // First column is for notification kind
            EXColumnHeader col = new EXColumnHeader("Type", 150);

            lvGCNGrid.Columns.Add(col);
            // And a column per cache type
            foreach (String key in listOfCacheTypes)
            {
                EXBoolColumnHeader boolcol = new EXBoolColumnHeader("", 20);
                boolcol.TrueImage  = _daddy.GetImageSized("Selected");
                boolcol.FalseImage = _daddy.GetImageSized("NotSelected");
                //col = new EXColumnHeader("", 50);
                lvGCNGrid.Columns.Add(boolcol);
            }

            // And a line with all cache type
            EXListViewItem lvi = new EXListViewItem("Cache types");

            lvGCNGrid.Items.Add(lvi);
            foreach (String key in listOfCacheTypes)
            {
                EXImageListViewSubItem si = new EXImageListViewSubItem(MyTools.ResizeImage(_daddy.GetImageSized(key), 16, 16));
                lvi.SubItems.Add(si);
            }

            // Add a line for each notification kind
            foreach (Tuple <String, List <int> > o in listOfAlloweKindPerCacheType)
            {
                lvi = new EXListViewItem(o.Item1);
                lvGCNGrid.Items.Add(lvi);
                foreach (int i in o.Item2)
                {
                    if (i != -1)
                    {
                        EXBoolListViewSubItem subi = new EXBoolListViewSubItem(false);
                        lvi.SubItems.Add(subi);
                    }
                    else
                    {
                        EXListViewSubItem subi = new EXListViewSubItem("");
                        subi.BackColor = Color.DarkBlue;
                        lvi.SubItems.Add(subi);
                    }
                }
            }
        }
Example #31
0
        void BtnGCNCreateClick(object sender, EventArgs e)
        {
            // On vérifie
            // coordonnées
            Double dLat = Double.MaxValue;
            Double dLon = Double.MaxValue;
            String sLat = "";
            String sLon = "";
            bool   bOK  = ParameterObject.TryToConvertCoordinates(tbGCNCenter.Text, ref sLat, ref sLon);

            if (sLat != CoordConvHMI._sErrorValue)
            {
                dLat = MyTools.ConvertToDouble(sLat);
            }
            if (sLon != CoordConvHMI._sErrorValue)
            {
                dLon = MyTools.ConvertToDouble(sLon);
            }
            if (!bOK)
            {
                DisplayError(lblGCNCentre.Text, _daddy.GetTranslator().GetString("WaypointCoord"), tbGCNCenter.Text, "");
                return;
            }

            // nom
            if (tbGCNName.Text == "")
            {
                DisplayError(lblGCNNom.Text, _daddy.GetTranslator().GetString("lblnotempty"), tbGCNName.Text, "");
                return;
            }

            // radius
            Int32 radius = 0;

            if (!Int32.TryParse(tbGCNRadius.Text, out radius))
            {
                DisplayError(lblGCNRadius.Text, _daddy.GetTranslator().GetString("lblnotnumber"), tbGCNRadius.Text, "");
                return;
            }

            // email
            if ((cbGCNEmails.Visible) && (cbGCNEmails.SelectedIndex == -1))
            {
                DisplayError(lblGCNEmail.Text, _daddy.GetTranslator().GetString("lblvalue"), "", "");
                return;
            }

            String email = "";

            if (cbGCNEmails.Items.Count != 0)
            {
                int pos = cbGCNEmails.SelectedIndex;
                email = cbGCNEmails.Items[pos].ToString();
            }

            // type
            // au moins une croix quelque part...
            // int associé au type de cache, nom du type de cache, liste des commandes POST pour kind of notif
            // Tuple<int, string, List<String>
            // on va créer un dico avec comme clé le type de cache
            Dictionary <String, Tuple <int, string, List <String> > > dicoCreation = new Dictionary <string, Tuple <int, string, List <string> > >();

            // On parcourt toutes les lignes, sauf la première qui correspond aux types
            for (int i = 1; i < lvGCNGrid.Items.Count; i++)
            {
                // On a l'item
                EXListViewItem lvi = (EXListViewItem)(lvGCNGrid.Items[i]);

                // On parcourt ses sous items
                for (int k = 1; k < lvi.SubItems.Count; k++)
                {
                    EXBoolListViewSubItem svi = lvi.SubItems[k] as EXBoolListViewSubItem;
                    if (svi != null)
                    {
                        // On a une valeur checkable
                        if (svi.BoolValue)
                        {
                            // Et elle est checkée !!
                            // On construit ce qu'il nous faut maintenant
                            //msg += listOfCacheTypes[k-1] + " " + listOfCacheTypesId[k-1] + " " + listOfAlloweKindPerCacheType[i-1].Item1 + " " + listOfAlloweKindPerCacheType[i-1].Item2[k-1] + "\r\n";


                            String typeofcache         = listOfCacheTypes[k - 1];
                            int    typeofcacheid       = listOfCacheTypesId[k - 1];
                            String kindofnotifreadable = listOfAlloweKindPerCacheType[i - 1].Item1;
                            String kindofnotifpost     = "ctl00$ContentBody$LogNotify$cblLogTypeList$" + listOfAlloweKindPerCacheType[i - 1].Item2[k - 1];
                            if (dicoCreation.ContainsKey(typeofcache))
                            {
                                // On met à jour la liste des kind of notif
                                Tuple <int, string, List <String> > obj = dicoCreation[typeofcache];
                                obj.Item3.Add(kindofnotifpost);
                            }
                            else
                            {
                                Tuple <int, string, List <String> > obj = new Tuple <int, string, List <string> >(typeofcacheid, typeofcache, new List <string>(new string[] { kindofnotifpost }));
                                dicoCreation.Add(typeofcache, obj);
                            }
                        }
                    }
                }
            }

            if (dicoCreation.Count == 0)
            {
                DisplayError(lblGCNGrid.Text, _daddy.GetTranslator().GetString("lblvalue"), "", "");
                return;
            }

            /*
             * foreach(KeyValuePair<String, Tuple<int, string, List<String>>> pair in dicoCreation)
             * {
             *      Tuple<int, string, List<String>> obj = pair.Value;
             *      msg += obj.Item1.ToString() + " " + obj.Item2 + " -> ";
             *      foreach(String s in obj.Item3)
             *      {
             *              msg += s + " ";
             *      }
             *      msg += "\r\n";
             * }
             * _daddy.MSG(msg);
             * return;
             */

            // On est valide, on peut créer
            _daddy._cacheDetail._gmap.ControlTextLatLon = null;

            // Go création
            CookieContainer cookieJar = _daddy.CheckGCAccount(true, false);
            String          url       = "https://www.geocaching.com/notify/edit.aspx";
            bool            error     = false;

            foreach (KeyValuePair <String, Tuple <int, string, List <String> > > pair in dicoCreation)
            {
                Tuple <int, string, List <String> > obj = pair.Value;
                // On demande la page par défaut pour initialiser une nouvelle demande
                HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
                objRequest.Proxy           = _daddy.GetProxy(); // Là encore, on peut virer le proxy si non utilisé (NULL)
                objRequest.CookieContainer = cookieJar;         // surtout récupérer le container de cookie qui est maintenant renseigné avec le cookie d'authentification
                HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
                String          post_response;
                using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
                {
                    post_response = responseStream.ReadToEnd();
                    responseStream.Close();
                }
                // On regarde si on a un message de warning
                if (NotificationsManager.CheckWarningMessage(_daddy, post_response))
                {
                    // Shit
                    error = true;
                    break;
                }

                // Une mise à jour pour définir le type de cache
                String post_string = NotificationsManager.GeneratePostString(_daddy, post_response, dLat, dLon, radius, tbGCNName.Text, obj, email, true);
                post_response = NotificationsManager.GeneratePostRequets(_daddy, url, post_string, cookieJar);

                // Une mise à jour pour définir le type de notif
                post_string   = NotificationsManager.GeneratePostString(_daddy, post_response, dLat, dLon, radius, tbGCNName.Text, obj, email, true);
                post_response = NotificationsManager.GeneratePostRequets(_daddy, url, post_string, cookieJar);
                if (NotificationsManager.CheckValidationMessage(_daddy, post_response))
                {
                    // Shit
                    error = true;
                    break;
                }
            }
            if (!error)
            {
                _daddy.MsgActionDone(this);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }