Exemplo n.º 1
0
        //Thread Method
        private void ProcessFile2(object state)
        {
            ThreadInfo2   threadInfo = state as ThreadInfo2;
            LabelDelegate FuncName   = threadInfo.FuncName;
            int           index      = threadInfo.SelectedIndex;

            //this.Invoke(new LabelDelegate(UpdateLabel));        //Invoke delegate function
            FuncName.Invoke("ProcessFile2 is invoked");
        }
Exemplo n.º 2
0
 public FormPlaying(int TableIndex, int Side, StreamWriter sw)
 {
     InitializeComponent();
     this.tableIndex     = TableIndex;
     this.side           = Side;
     labelDelegate       = new LabelDelegate(SetLabel);
     buttonDelegate      = new ButtonDelegate(SetButton);
     radioButtonDelegate = new RadioButtonDelegate(SetRadioButton);
     blackBitmap         = new Bitmap(Properties.Resources.black);
     whiteBitmap         = new Bitmap(Properties.Resources.white);
     service             = new Service(listBox1, sw);
 }
Exemplo n.º 3
0
 private void LabelText(Label label, string text)
 {
     if (label.InvokeRequired)
     {
         LabelDelegate d = LabelText;
         label.Invoke(d, new object[] { label, text });
     }
     else
     {
         label.Text = text;
     }
 }
Exemplo n.º 4
0
 private void Label2Change(string detail)
 {
     if (this.label2.InvokeRequired == false)
     {
         this.label2.Text = detail;
     }
     else
     {
         LabelDelegate LChangeD = new LabelDelegate(Label2Change);
         this.label2.Invoke(LChangeD, detail);
     }
 }
Exemplo n.º 5
0
 public FormPlaying(int TableIndex, int Side, StreamWriter sw)
 {
     InitializeComponent();
     this.tableIndex = TableIndex;
     this.side = Side;
     this.color = side;
     labelDelegate = new LabelDelegate(SetLabel);
     buttonDelegate = new ButtonDelegate(SetButton);
     radioButtonDelegate = new RadioButtonDelegate(SetRadioButton);
     blackBitmap = new Bitmap(Properties.Resources.black);
     whiteBitmap = new Bitmap(Properties.Resources.white);
     service = new Service(listBox1, sw);
 }
Exemplo n.º 6
0
        delegate void SetDotDelegate(int i, int j, int ChessColor);               //

        public PlayingTable(int TableIndex, int Side, StreamWriter sw)
        {
            InitializeComponent();  //The indispensable code for a windows application's construction
            this.StartPosition = FormStartPosition.CenterScreen;

            this.tableIndex = TableIndex;
            this.side       = Side;
            this.sw         = sw;

            labelDelegate         = new LabelDelegate(SetLabel);
            buttonDelegate        = new ButtonDelegate(SetButton);
            setPictureBoxDelegate = new SetPictureBoxDelegate(SetPictureBoxImage);

            blackBitmap            = new Bitmap(Properties.Resources.blackChess);
            whiteBitmap            = new Bitmap(Properties.Resources.whiteChess);
            blackBoomBitmap        = new Bitmap(Properties.Resources.blackBoom);
            whiteBoomBitmap        = new Bitmap(Properties.Resources.whiteBoom);
            blackTrapBitmap        = new Bitmap(Properties.Resources.blackTrap);
            whiteTrapBitmap        = new Bitmap(Properties.Resources.whiteTrap);
            blackIllusionBitmap    = new Bitmap(Properties.Resources.blackChessIllusion);
            whiteIllusionBitmap    = new Bitmap(Properties.Resources.whiteChessIllusion);
            FrozenblackChessBitmap = new Bitmap(Properties.Resources.FrozenblackChess);
            FrozenwhiteChessBitmap = new Bitmap(Properties.Resources.FrozenwhiteChess);
            Division           = new Bitmap(Properties.Resources.Division);
            DivisionDARK       = new Bitmap(Properties.Resources.DivisionDARK);
            illusion           = new Bitmap(Properties.Resources.illusion);
            illusionDARK       = new Bitmap(Properties.Resources.illusionDARK);
            FreezingBreath     = new Bitmap(Properties.Resources.FreezingBreath);
            FreezingBreathDARK = new Bitmap(Properties.Resources.FreezingBreathDARK);
            Shackle            = new Bitmap(Properties.Resources.Shackle);
            ShackleDARK        = new Bitmap(Properties.Resources.ShackleDARK);

            chessSound = new SoundPlayer(Properties.Resources.ChessSound);
            music      = new SoundPlayer(Properties.Resources.BackgroundMusic);

            pictureBoxDivision.Image = Division;
            pictureBoxIllusion.Image = illusion;
            pictureBoxFrozen.Image   = FreezingBreath;
            pictureBoxShackles.Image = Shackle;



            radioButtonMusic.Checked = true; //By default, select radioButtonMusic. Play the background music
                                             //When "checked" property is altered, it will trigger CheckedChange event
        }
Exemplo n.º 7
0
        public FormPlaying(int TableIndex, int Side, StreamWriter sw)
        {
            InitializeComponent();
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
            draw = new Draw(painter);

            this.tableIndex = TableIndex;
            this.side       = Side;
            labelDelegate   = new LabelDelegate(SetLabel);
            buttonDelegate  = new ButtonDelegate(SetButton);
            service         = new Service(listBox1, sw);
            if (side == 0)
            {
                PlayerColor.Text = "黑方";
            }
            else
            {
                PlayerColor.Text = "白方";
            }
        }
Exemplo n.º 8
0
 public FormPlaying(int TableIndex, int Side, StreamWriter sw)
 {
     InitializeComponent();
     this.tableIndex = TableIndex;
     this.side       = Side;
     order           = false;
     baseX           = 50;
     baseY           = 50;
     interval        = 60;
     binterval       = 30;
     r              = 25;
     oriX           = -1;
     oriY           = -1;
     endX           = -1;
     endY           = -1;
     pick           = -1;
     labelDelegate  = new LabelDelegate(SetLabel);
     buttonDelegate = new ButtonDelegate(SetButton);
     service        = new Client.Service(listBox1, sw);
 }
Exemplo n.º 9
0
        private void ThreadDelete(string user)
        {
            BtnDelegate    btn    = new BtnDelegate(BtnTxt);
            LabelDelegate  label  = new LabelDelegate(LabelTxt);
            PrograDelegate Progra = new PrograDelegate(PrograStepup);

            int i = 1;

            foreach (KeyValuePair <string, string> kv in carpark)
            {
                if (ToolsUtility.Ping(kv.Value))
                {
                    this.Invoke(label, kv.Key, 1);
                    this.Invoke(label, i.ToString() + "/" + carpark.Count.ToString(), 2);
                    DBUtility.DeleteUser(user, kv.Key, kv.Value);
                }
                this.Invoke(Progra);
                i++;
            }
            this.Invoke(btn);
        }
Exemplo n.º 10
0
        private void ThreadAdd(PmsVehicleClass pvc)
        {
            BtnDelegate    btn    = new BtnDelegate(BtnTxt);
            LabelDelegate  label  = new LabelDelegate(LabelTxt);
            PrograDelegate Progra = new PrograDelegate(PrograStepup);

            int i = 1;

            foreach (KeyValuePair <string, string> kv in carpark)
            {
                if (ToolsUtility.Ping(kv.Value))
                {
                    this.Invoke(label, kv.Key, 1);
                    this.Invoke(label, i.ToString() + "/" + carpark.Count.ToString(), 2);
                    DBUtility.AddStaffIU(pvc, kv.Key, kv.Value);
                }
                this.Invoke(Progra);
                i++;
            }
            this.Invoke(btn);
        }
Exemplo n.º 11
0
        private void ThreadAdd(PmsUserClass user)
        {
            BtnDelegate    btn    = new BtnDelegate(BtnTxt);
            LabelDelegate  label  = new LabelDelegate(LabelTxt);
            PrograDelegate Progra = new PrograDelegate(PrograStepup);

            int i = 1;

            foreach (KeyValuePair <string, string> kv in carpark)
            {
                this.Invoke(label, kv.Key, 1);
                this.Invoke(label, i.ToString() + "/" + carpark.Count.ToString(), 2);
                //  LogClass.wirteLine("Carpark"+kv.Key+",IP:"+kv.Value);
                if (ToolsUtility.Ping(kv.Value.ToString()))
                {
                    DBUtility.AddUser(user, kv.Key, kv.Value);
                }
                this.Invoke(Progra);
                i++;
            }
            this.Invoke(btn);
        }
Exemplo n.º 12
0
 private void LabelOff(Label Info)
 {
     if (Info.InvokeRequired)
     {
         LabelDelegate DDD = new LabelDelegate(LabelOff);
         Info.Invoke(DDD, new object[] { Info });
     }
     else
     {
         Info.Visible = false;
     }
 }