Пример #1
0
        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);
            }
        }
Пример #2
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);
    }
Пример #3
0
        void UpdateReaderState(string ReaderName, uint ReaderState, CardBuffer CardAtr)
        {
            Console.WriteLine(DateTime.Now.ToString(NowFormat));
            Console.WriteLine("\tStatus changed for '" + ReaderName + "'");
            Console.WriteLine("\t\tState: " + SCARD.ReaderStatusToString(ReaderState));
            if (CardAtr != null)
            {
                Console.WriteLine("\t\tATR: " + CardAtr.AsString(" "));
            }

            for (int i = 0; i < lvReaders.Items.Count; i++)
            {
                EXImageListViewItem item = (EXImageListViewItem)lvReaders.Items[i];

                if (item.MyValue.Equals(ReaderName))
                {
                    /* Reader found in the list */
                    /* ------------------------ */

                    lvReaders.BeginUpdate();

                    /* Set status image */
                    int    statusImage;
                    string statusText;

                    if ((ReaderState & SCARD.STATE_PRESENT) != 0)
                    {
                        /* Card is present */
                        if ((ReaderState & SCARD.STATE_INUSE) != 0)
                        {
                            /* Card in use */
                            if ((ReaderState & SCARD.STATE_EXCLUSIVE) != 0)
                            {
                                /* Card in exclusive use */
                                statusText  = "In use (exclusive)";
                                statusImage = StatusImageExclusive;
                            }
                            else
                            {
                                statusText  = "In use (shared)";
                                statusImage = StatusImageInUse;
                            }
                        }
                        else
                        if ((ReaderState & SCARD.STATE_MUTE) != 0)
                        {
                            /* Card is mute */
                            statusText  = "Mute";
                            statusImage = StatusImageMute;
                        }
                        else
                        if ((ReaderState & SCARD.STATE_UNPOWERED) != 0)
                        {
                            /* Card is not powered */
                            statusText  = "Present, not powered";
                            statusImage = StatusImagePresent;
                        }
                        else
                        {
                            /* Card is powered */
                            statusText  = "Present, powered";
                            statusImage = StatusImagePresent;
                        }
                    }
                    else
                    if ((ReaderState & SCARD.STATE_UNAVAILABLE) != 0)
                    {
                        /* Problem */
                        statusText  = "Reserved (direct)";
                        statusImage = StatusImageUnavailable;
                    }
                    else
                    if ((ReaderState & SCARD.STATE_IGNORE) != 0)
                    {
                        /* Problem */
                        statusText  = "Error (ignore)";
                        statusImage = StatusImageError;
                    }
                    else
                    if ((ReaderState & SCARD.STATE_UNKNOWN) != 0)
                    {
                        /* Problem */
                        statusText  = "Error (status unknown)";
                        statusImage = StatusImageUnknown;
                    }
                    else
                    if ((ReaderState & SCARD.STATE_EMPTY) != 0)
                    {
                        /* No card */
                        statusText  = "Absent";
                        statusImage = StatusImageAbsent;
                    }
                    else
                    {
                        /* Problem */
                        statusText  = "Bad status";
                        statusImage = StatusImageError;
                    }

                    EXImageListViewSubItem subitem = (EXImageListViewSubItem)item.SubItems[2];
                    subitem.MyImage       = statusImages.Images[statusImage];
                    item.SubItems[3].Text = statusText;

                    if (CardAtr != null)
                    {
                        item.SubItems[4].Text = CardAtr.AsString("");
                    }
                    else
                    {
                        item.SubItems[4].Text = "";
                    }

                    lvReaders.EndUpdate();
                    break;
                }
                /* NB : we ignore the event in case the reader is not already listed */
            }
        }
Пример #4
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);
	}