示例#1
0
        private void btnStatus_Click(object sender, EventArgs e)
        {
            //if (dataGridClients.SelectedCells.Count > 0)
            //{
            //    m_TmpClientIP = dataGridClients.Rows[dataGridClients.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
            //    m_TmpClientName = dataGridClients.Rows[dataGridClients.SelectedCells[0].RowIndex].Cells[1].Value.ToString();

            //    this.Text = "Waiting for reply...";

            //    Thread ClientStatusQuery = new Thread(new ParameterizedThreadStart(ExecutingQueries));
            //    ClientStatusQuery.Start();

            //}


            // if (dataGridClients.SelectedCells.Count > 0)
            foreach (DataGridViewRow row in dataGridClients.Rows)
            {
                // if (row.Index == 0)
                {
                    var cInfo = new BaseClass.ClientInfo(row.Cells[0].Value.ToString(), row.Cells[1].Value.ToString(), Consts.ClientStatus.Unknown, Consts.NetStatus.Offline);
                    m_TmpClientIP   = row.Cells[0].Value.ToString();
                    m_TmpClientName = row.Cells[1].Value.ToString();

                    this.Text = "درانتظار پاسخ...";

                    Thread ClientStatusQuery = new Thread(new ParameterizedThreadStart(ExecutingQueries));
                    ClientStatusQuery.Start(cInfo);
                }
            }
        }
示例#2
0
        public override BaseClass.ReplyData ExecuteQuery(string i_IP, int i_Port, BaseClass.ClientInfo clientInfo)
        {
            QueryData StatusQueryData = new QueryData();

            StatusQueryData.Type       = Consts.SectionType.CaptureScreen;
            StatusQueryData.CurrClient = clientInfo;
            string QueryString = StatusQueryData.Serialize();
            //String ReplyString = Comm.SendQuery(i_IP, i_Port, QueryString);
            String    ReplyString  = Comm.SendQuery(clientInfo.IP, i_Port, QueryString);
            ReplyData ReplyDataObj = ReplyData.Deserialize(ReplyString);

            return(ReplyDataObj);
        }
示例#3
0
        private void ExecutingMessage(QueryData StatusQueryData, BaseClass.ClientInfo cInfo1)
        {
            ReplyData ReplyDataObj;
            var       CliInfoS = cInfo1 as BaseClass.ClientInfo;

            try
            {
                //ObjectMetaData ActiveSession = new ObjectMetaData();
                //ActiveSession.Text = this._activeGovSession._PhysicalPath;
                //ActiveSession.Tag = "ActiveSession";
                //StatusQueryData.ArrCounter.Add(ActiveSession);

                //ObjectMetaData PageNumber = new ObjectMetaData();

                //if (CurrentViewControl == _ucOfferReport)
                //{
                //    PageNumber.Text = _ucOfferReport.ucViewGovReportPic1.BindingSource.Position.ToString();
                //}
                //else if (CurrentViewControl == _ucViewPresentation)
                //{
                //    PageNumber.Text = _ucViewPresentation.BindingSource.Position.ToString();
                //}

                //PageNumber.Tag = "PageNumber";
                //StatusQueryData.ArrCounter.Add(PageNumber);

                //ObjectMetaData IsViewWordDoc = new ObjectMetaData();
                //IsViewWordDoc.Text = "False";
                //if (CurrentViewControl == _ucOfferReport)
                //{
                //    IsViewWordDoc.Text = _ucOfferReport.IsViewWordDocument.ToString();
                //}
                //IsViewWordDoc.Tag = "IsViewWordDoc";
                //StatusQueryData.ArrCounter.Add(IsViewWordDoc);

                //StatusQueryData.CurrClient = clientInfo;

                string QueryString = StatusQueryData.Serialize();
                String ReplyString = Comm.SendQuery(CliInfoS.IP, SCUtility.m_AppDef.m_Port, QueryString);
                ReplyDataObj = ReplyData.Deserialize(ReplyString);
            }
            catch (Exception)
            {
                ReplyDataObj = null;
            }
        }
示例#4
0
        private void tsbtnShutdownPC_Click(object sender, EventArgs e)
        {
            QueryData StatusQueryData = new QueryData();

            StatusQueryData.Type = Consts.SectionType.DoAction;
            ObjectMetaData obj = new ObjectMetaData();

            obj.Text = "";
            obj.Tag  = "Shutdown";
            StatusQueryData.ArrCounter.Add(obj);


            Collection <BaseClass.ClientInfo> AllCliecnt = new Collection <ClientInfo>();

            foreach (DataGridViewRow itm in dataGridClients.SelectedRows)
            {
                BaseClass.ClientInfo ClientInfoTemp = null;
                foreach (ClientInfo CurrClient in SCUtility.m_AppDef.ArrClients)
                {
                    if (CurrClient.IP.CompareTo(itm.Cells["IP"].Value.ToString()) == 0)
                    {
                        ClientInfoTemp = CurrClient;
                    }
                }

                if (ClientInfoTemp != null)
                {
                    AllCliecnt.Add(ClientInfoTemp);
                }
            }

            foreach (BaseClass.ClientInfo row in AllCliecnt)//SCUtility.m_AppDef.ArrClients)
            {
                // this.Text = "Waiting for reply...";

                ClientInfo CliInfoS          = new ClientInfo(row.IP, row.Name);
                Thread     ClientStatusQuery = new Thread(delegate() { ExecutingPathQueries(StatusQueryData, CliInfoS); });
                //  Thread ClientStatusQuery = new Thread(UpdateStatusDelegate() {});
                ClientStatusQuery.Start();
            }
        }
示例#5
0
        private void UpdateClientStatus(ReplyData ReplyDataObj, BaseClass.ClientInfo cinfo)
        {
            m_ReplyDataObj = ReplyDataObj;
            Consts.ClientStatus NewClientStatus = Consts.ClientStatus.Failure;

            if (m_ReplyDataObj != null)
            {
                NewClientStatus = Consts.ClientStatus.Connected;
            }

            for (int CurrClientIndex = 0; CurrClientIndex < SCUtility.m_AppDef.ArrClients.Count; ++CurrClientIndex)
            {
                if (((ClientInfo)SCUtility.m_AppDef.ArrClients[CurrClientIndex]).IP.CompareTo(cinfo.IP) == 0)
                {
                    ((ClientInfo)SCUtility.m_AppDef.ArrClients[CurrClientIndex]).Status = NewClientStatus;
                }
            }

            this.Text = "Clients List";
            LoadClientsList();
        }