public ALEmanCafe()
        {
            InitializeComponent();
            this.PassTextBox.UseSystemPasswordChar = true;
            this.UserTextBox.KeyPress += new KeyPressEventHandler(UserTextBox_KeyPress);
            this.PassTextBox.KeyPress += new KeyPressEventHandler(PassTextBox_KeyPress);

            MyDatabase.ALEmancafe = this;
            if (MyDatabase.LoadDatabaseConfig())
            {
            }
            if (MyDatabase.CreateDB(true))
            {
            }
            if (MyDatabase.LoadSystemlogTimers())
            {
            }

            this.Server = new ALEmanCafeServer();
            if (!this.Server.LoadALEmanCafeServer(this))
            {
            }
            if (MyDatabase.Load())
            {
            }
            if (!Program.OrLanguage)
            {
                TranslateAR();
            }
        }
 public AddTime(ALEmanCafeServer ACS, NetworkItems NI)
 {
     InitializeComponent();
     this.TimeTextBox.KeyDown += new KeyEventHandler(TimeTextBox_KeyDown);
     this.ACS = ACS;
     this.NI  = NI;
     TimeTextBox.TextChanged += new EventHandler(TimeTextBox_TextChanged);
 }
        public ChangePC(ALEmanCafeServer ACS, NetworkItems NI)
        {
            InitializeComponent();
            this.ACS = ACS;
            this.NI = NI;
            this.KeyDown += new KeyEventHandler(TimeTextBox_KeyDown);
            this.listView1.KeyDown += new KeyEventHandler(TimeTextBox_KeyDown);
            this.CancelCloseButton.KeyDown += new KeyEventHandler(TimeTextBox_KeyDown);
            this.OKButton.KeyDown += new KeyEventHandler(TimeTextBox_KeyDown);
            this.listView1.ItemActivate += new EventHandler(listView1_ItemActivate);
            if (this.listView1.InvokeRequired)
            {
                this.listView1.BeginInvoke(new MethodInvoker(
                    () =>
                    {
                        this.listView1.SmallImageList = new ImageList();
                        this.listView1.SmallImageList.ImageSize = new Size(31, 40);
                        this.listView1.SmallImageList.Images.Add("OnlineDisplay", Properties.Resources.OnlineDisplay);
                    }));
            }
            else
            {
                this.listView1.SmallImageList = new ImageList();
                this.listView1.SmallImageList.ImageSize = new Size(31, 40);
                this.listView1.SmallImageList.Images.Add("OnlineDisplay", Properties.Resources.OnlineDisplay);
            }

            foreach (NetworkItems NI2 in NetworkItems.IdleNetworks.Values)
            {
                if (NI2.Connected == false) continue;
                string[] st = new string[3];
                st[0] = NI2.ShownName;
                st[1] = NI2.IP;
                st[2] = NI2.UsedTime.ToString();
                ListViewItem LVI = new ListViewItem(st);
                LVI.Text = LVI.Name = NI2.ShownName;
                LVI.ToolTipText = "From " + NI.ShownName + " To " + NI2.ShownName;
                LVI.Tag = NI2;
                LVI.ImageKey = "OnlineDisplay";
                if (this.listView1.InvokeRequired)
                {
                    this.listView1.BeginInvoke(new MethodInvoker(
                        () => this.listView1.Items.Add(LVI)));
                }
                else
                {
                    this.listView1.Items.Add(LVI);
                }
            }

            this.listView1.ItemSelectionChanged += ListView1_ItemSelectionChanged;
        }
Exemplo n.º 4
0
        public RemoteApplications(ALEmanCafeServer ACS, List <AppInfo> AIL, NetworkItems NI)
        {
            InitializeComponent();
            this.ACS = ACS;
            this.AIL = AIL;
            this.NI  = NI;
            //listView1.SmallImageList = new ImageList();
            //  int tname = 1;
            foreach (ALEmanCafe_Server.RemoteApplications.AppInfo AI in AIL)
            {
                string[] info = new string[4];
                info[0] = AI.AppName;
                info[1] = AI.AppTitle;
                info[2] = AI.AppPath;
                info[3] = AI.APPID.ToString();
                ListViewItem Lvi = new ListViewItem(info);
                Lvi.Name = Lvi.Text = Lvi.ToolTipText = AI.AppName;

                /*
                 * if (AI.AppICon != null)
                 *  if (this.listView1.InvokeRequired)
                 *  {
                 *      this.listView1.BeginInvoke(new MethodInvoker(
                 *          () => this.listView1.SmallImageList.Images.Add(tname.ToString(), AI.AppICon)));
                 *  }
                 *  else
                 *  {
                 *      this.listView1.SmallImageList.Images.Add(tname.ToString(), AI.AppICon);
                 *  }
                 *
                 * Lvi.ImageKey = tname.ToString();
                 * tname++;
                 */
                if (this.AppsView.InvokeRequired)
                {
                    this.AppsView.BeginInvoke(new MethodInvoker(
                                                  () => this.AppsView.Items.Add(Lvi)));
                }
                else
                {
                    this.AppsView.Items.Add(Lvi);
                }
            }
            if (AIL.Count <= 0)
            {
                this.TerminateSelected.Enabled = false;
            }
            AppsView.MouseClick += new MouseEventHandler(AppsView_MouseClick);
            AppsView.KeyDown    += new KeyEventHandler(AppsView_KeyPress);
        }
 public SendMessage(ALEmanCafeServer ACS, NetworkItems NI)
 {
     InitializeComponent();
     this.ACS = ACS;
     this.NI  = NI;
 }
        public RemoteManagement(ALEmanCafeServer ACS, NetworkItems NI)
        {
            InitializeComponent();
            this.ACS   = ACS;
            this.NI    = NI;
            this.NI.RM = this;
            this.RPort = Program.PPort;
            Program.PPort++;
            this.SPort = Program.PPort;
            Program.PPort++;
            //  this.ACS.writeamess("IP : " + NI.IP);
            this.ACS.SendPCStatus(NI, ALEmanCafeServer.MessageStatus.startremote, false, (uint)this.RPort, false, null, null, null, this.SPort);
            this.FormClosing  += new FormClosingEventHandler(RemoteManagement_FormClosing);
            pictureBox1.Paint += PictureBox1Paint;

            ReciverTimer           = new System.Timers.Timer(20);
            ReciverTimer.AutoReset = true;
            ReciverTimer.Elapsed  += new System.Timers.ElapsedEventHandler(RecieveInfos);

            /*
             * if (this.InvokeRequired)
             * {
             *  this.BeginInvoke(new MethodInvoker(
             *      () => ReciverTimer.Start()));
             * }
             * else
             * {
             *  ReciverTimer.Start();
             * }
             */
            SenderTimer           = new System.Timers.Timer(50);
            SenderTimer.AutoReset = true;
            SenderTimer.Elapsed  += new System.Timers.ElapsedEventHandler(SenderInfos);

            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(
                                     () =>
                {
                    ReciverTimer.Start();
                    SenderTimer.Start();
                    this.MouseDown             += new MouseEventHandler(RemoteManagement_MouseClick);
                    this.pictureBox1.MouseDown += new MouseEventHandler(RemoteManagement_MouseClick);
                    this.panel1.MouseDown      += new MouseEventHandler(RemoteManagement_MouseClick);
                    this.KeyDown += new KeyEventHandler(RemoteManagement_KeyDown);
                }));
            }
            else
            {
                ReciverTimer.Start();
                SenderTimer.Start();
                this.MouseDown             += new MouseEventHandler(RemoteManagement_MouseClick);
                this.pictureBox1.MouseDown += new MouseEventHandler(RemoteManagement_MouseClick);
                this.panel1.MouseDown      += new MouseEventHandler(RemoteManagement_MouseClick);
                this.KeyDown += new KeyEventHandler(RemoteManagement_KeyDown);
            }

            /*
             * this.MouseDown += new MouseEventHandler(RemoteManagement_MouseClick);
             * this.pictureBox1.MouseDown += new MouseEventHandler(RemoteManagement_MouseClick);
             * this.panel1.MouseDown += new MouseEventHandler(RemoteManagement_MouseClick);
             *
             * this.KeyDown += new KeyEventHandler(RemoteManagement_KeyDown);
             */
        }