Exemple #1
0
        private void Delete(object obj)
        {
            string sqlStr = "delete from shebeiguanli where ";

            int index = 0;

            foreach (var item in tableList)
            {
                if (item.bSel)
                {
                    if (index == 0)
                    {
                        sqlStr += " Shebeiguanli.[Xuhao]=" + item.Xuhao;
                    }
                    else
                    {
                        sqlStr += " or Shebeiguanli.[Xuhao]=" + item.Xuhao;
                    }

                    index++;
                }
            }


            if (index > 0)
            {
                WorkServer.excuteSql(sqlStr, Marshal.GetFunctionPointerForDelegate(_excutesqlCallBackDelegate), true);
                QueryShebeiguanli(null);
            }
        }
Exemple #2
0
        public void QueryYingshebiao(object obj)
        {
            _yingshelList.Clear();
            cardstatus.Clear();
            businesstype.Clear();
            certificateType.Clear();
            WorkServer.QueryTable("select * from Yingshebiao", Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);

            cardstatus.Add("全部");
            businesstype.Add("全部");
            certificateType.Add("全部");
            foreach (KeyValuePair <int, string> kvp0 in _yingshelList)
            {
                if (kvp0.Key >= 7000 && kvp0.Key < 8000)
                {
                    cardstatus.Add(kvp0.Value);
                }

                if (kvp0.Key >= 4000 && kvp0.Key < 5000)
                {
                    businesstype.Add(kvp0.Value);
                }

                if (kvp0.Key >= 5000 && kvp0.Key < 6000)
                {
                    devicePosition.Add(kvp0.Value);
                }

                if (kvp0.Key >= 9000 && kvp0.Key < 9011)
                {
                    certificateType.Add(kvp0.Value);
                }
            }
        }
Exemple #3
0
 public void QueryYongHuguanli(object obj)
 {
     tableList.Clear();
     _tableListTemp.Clear();
     _guliyuanList.Clear();
     WorkServer.QueryTable(MakeQuerySql(null), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #4
0
 public void QueryShebeiguanli(object obj)
 {
     _queryEnum = OperateEnum.OperateEnum_QueryDevice;
     _tableListTemp.Clear();
     tableList.Clear();
     WorkServer.QueryTable(MakeQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate));
 }
Exemple #5
0
        private void Query(object obj)
        {
            status = "";
            tableList0.Clear();
            string sql = "select * from " + tableName;

            WorkServer.QueryTable(sql, Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate));
        }
Exemple #6
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     try
     {
         bOnline = WorkServer.isClientStoped() == false;
     }
     catch { }
 }
Exemple #7
0
 public void QueryShebeiguanli(object obj)
 {
     city.Clear();
     ju.Clear();
     danwei.Clear();
     deviceList.Clear();
     _tableListTemp.Clear();
     tableList.Clear();
     WorkServer.QueryTable(MakeQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate));
 }
Exemple #8
0
 public void DoLogon()
 {
     city.Clear();
     ju.Clear();
     danwei.Clear();
     deviceList.Clear();
     _tableListTemp.Clear();
     tableList.Clear();
     WorkServer.QueryTable(MakeQuerySql(null), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #9
0
        protected override void OnExit(ExitEventArgs e)
        {
            WorkServer.stopClient();
            LineChartServer.UninitializeCurveModule();
            HistogramServer.UninitializeHistogramModule();
            OccupancyChartServer.UninitializeOccupancyModule();
            PieChartServer.UninitializePieModule();

            base.OnExit(e);
        }
Exemple #10
0
 private void Operate(object obj)
 {
     if (speedbgw != null && !speedbgw.IsBusy)
     {
         _queryEnum = OperateEnum.OperateEnum_QueryTestSpeed;
         statusText = "测速中……";
         Angle      = -130;
         IPAddress addr;
         if (IPAddress.TryParse(testIP, out addr))
         {
             WorkServer.queryDevSpeed(testIP, Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
         }
     }
 }
Exemple #11
0
 private void signin_Click(object sender, EventArgs e)
 {
     infoRegistration.Text = "";
     if (isValid(emailtext.Text) && PassswordWithLogin(passwordtext.Text, logintext.Text))
     {
         WorkServer workServer = new WorkServer();
         /*workServer.createConnection();*/
         workServer.addUser(logintext.Text, passwordtext.Text, emailtext.Text);
         /*workServer.loseConnection();*/
         this.Hide();
     }
     else
     {
         infoRegistration.Text = "Допущена ошибка при вводе данных.";
     }
 }
Exemple #12
0
        public void QueryConnectionsStatu(object obj)
        {
            foreach (DeviceModel model0 in DevicemaViewModel._deviceList)
            {                                   //市
                foreach (DeviceModel model1 in model0.Children)
                {                               //局
                    foreach (DeviceModel model2 in model1.Children)
                    {                           //单位
                        foreach (DeviceModel model3 in model2.Children)
                        {                       //IP
                            model3.bStatus = 2; ////不在线
                        }
                    }
                }
            }

            WorkServer.queryConnectionsStr(Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), false);
        }
Exemple #13
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            try
            {
                bOnline        = WorkServer.isServerStoped() == false;
                curConnections = WorkServer.cntServerConnections() + "个";

                IntPtr strPtr    = WorkServer.curConnectionsStr();
                string resultStr = Marshal.PtrToStringAnsi(strPtr);
                if (resultStr != _connectionsStr)
                {
                    _connectionsStr = resultStr;
                    tableList.Clear();
                    QueryTableCallBack(_connectionsStr, "");
                }
            }
            catch { }
        }
Exemple #14
0
        private void Delete(object obj)
        {
            string sqlStr = "delete from " + tableName + " where ";

            DataGrid grid = obj as DataGrid;

            int index = 0;

            foreach (var item in grid.SelectedItems)
            {
                if (item.GetType() != typeof(YINGSHEBIAOModel))
                {
                    if (index == 0)
                    {
                        sqlStr += " " + tableName + ".[Xuhao]=" + item.GetType().GetProperty("Xuhao").GetValue(item, null);
                    }
                    else
                    {
                        sqlStr += " or" + " " + tableName + ".[Xuhao]=" + item.GetType().GetProperty("Xuhao").GetValue(item, null);
                    }
                }
                else
                {
                    if (index == 0)
                    {
                        sqlStr += " " + tableName + ".[Bianhao]=" + item.GetType().GetProperty("Bianhao").GetValue(item, null);
                    }
                    else
                    {
                        sqlStr += " or" + " " + tableName + ".[Bianhao]=" + item.GetType().GetProperty("Bianhao").GetValue(item, null);
                    }
                }

                index++;
            }


            if (index > 0)
            {
                WorkServer.excuteSql(sqlStr, Marshal.GetFunctionPointerForDelegate(_excutesqlCallBackDelegate), true);
                Query(null);
            }
        }
Exemple #15
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Id;
         result = (result * 397) ^ (State != null ? State.GetHashCode() : 0);
         result = (result * 397) ^ StateEnum.GetHashCode();
         result = (result * 397) ^ Project;
         result = (result * 397) ^ Run;
         result = (result * 397) ^ Clone;
         result = (result * 397) ^ Gen;
         result = (result * 397) ^ (Core != null ? Core.GetHashCode() : 0);
         result = (result * 397) ^ (UnitId != null ? UnitId.GetHashCode() : 0);
         result = (result * 397) ^ (PercentDone != null ? PercentDone.GetHashCode() : 0);
         result = (result * 397) ^ TotalFrames;
         result = (result * 397) ^ FramesDone;
         result = (result * 397) ^ (Assigned != null ? Assigned.GetHashCode() : 0);
         result = (result * 397) ^ (AssignedDateTime.HasValue ? AssignedDateTime.Value.GetHashCode() : 0);
         result = (result * 397) ^ (Timeout != null ? Timeout.GetHashCode() : 0);
         result = (result * 397) ^ (TimeoutDateTime.HasValue ? TimeoutDateTime.Value.GetHashCode() : 0);
         result = (result * 397) ^ (Deadline != null ? Deadline.GetHashCode() : 0);
         result = (result * 397) ^ (DeadlineDateTime.HasValue ? DeadlineDateTime.Value.GetHashCode() : 0);
         result = (result * 397) ^ (WorkServer != null ? WorkServer.GetHashCode() : 0);
         result = (result * 397) ^ (WorkServerIPAddress != null ? WorkServerIPAddress.GetHashCode() : 0);
         result = (result * 397) ^ (CollectionServer != null ? CollectionServer.GetHashCode() : 0);
         result = (result * 397) ^ (CollectionServerIPAddress != null ? CollectionServerIPAddress.GetHashCode() : 0);
         result = (result * 397) ^ (WaitingOn != null ? WaitingOn.GetHashCode() : 0);
         result = (result * 397) ^ Attempts;
         result = (result * 397) ^ (NextAttempt != null ? NextAttempt.GetHashCode() : 0);
         result = (result * 397) ^ (NextAttemptTimeSpan.HasValue ? NextAttemptTimeSpan.Value.GetHashCode() : 0);
         result = (result * 397) ^ Slot;
         result = (result * 397) ^ (Eta != null ? Eta.GetHashCode() : 0);
         result = (result * 397) ^ (EtaTimeSpan.HasValue ? EtaTimeSpan.Value.GetHashCode() : 0);
         result = (result * 397) ^ Ppd.GetHashCode();
         result = (result * 397) ^ (Tpf != null ? Tpf.GetHashCode() : 0);
         result = (result * 397) ^ (TpfTimeSpan.HasValue ? TpfTimeSpan.Value.GetHashCode() : 0);
         result = (result * 397) ^ BaseCredit.GetHashCode();
         result = (result * 397) ^ CreditEstimate.GetHashCode();
         result = (result * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         return(result);
     }
 }
Exemple #16
0
        private void StartServer(object obj)
        {
            try
            {
                string ip   = "";
                int    port = 0;
                foreach (string key in ConfigurationManager.AppSettings)
                {
                    if (key == "ServerIP")
                    {
                        ip = ConfigurationManager.AppSettings[key];
                    }
                    else if (key == "ServerPort")
                    {
                        port = Convert.ToInt32(ConfigurationManager.AppSettings[key]);
                    }
                }

                WorkServer.startServer(ip, port);
            }
            catch
            {
            }
        }
Exemple #17
0
        protected override void OnExit(ExitEventArgs e)
        {
            WorkServer.stopServer();

            base.OnExit(e);
        }
Exemple #18
0
 public void QueryHistogramChartData(object obj)
 {
     _queryoperate = QueryOperate.QueryOperate_HistogramChart;
     WorkServer.QueryTable(MakeHistogramChartQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #19
0
 private void Statistics(object obj)
 {
     WorkServer.QueryTable(MakeStatisticsQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #20
0
 public void QueryShebeiguzhang(object obj)
 {
     _queryoperate = QueryOperate.QueryOperate_Guzhang;
     WorkServer.QueryTable(MakeShebeiguzhangCurMonthQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #21
0
        private void Operate(object obj)
        {
            switch (operateenum)
            {
            case OperateEnum.OperateEnum_Add:
            {
                string tableName = "Shebeiguanli";
                int    addCount  = 1;
                Random ran       = new Random();
                Type   type      = typeof(SHEBEIGUANLIModel);

                if (type != null)
                {
                    System.Reflection.PropertyInfo[] properties = type.GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);

                    DateTime time   = DateTime.Now;
                    string   addXml = "";
                    for (int i = 0; i < addCount; ++i)
                    {
                        foreach (System.Reflection.PropertyInfo item in properties)
                        {
                            if (item.PropertyType.Name.StartsWith("Int32"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                switch (item.Name)
                                {
                                case "Xuhao":
                                    addXml += "0";
                                    break;

                                default:
                                    addXml += item.GetValue(customInfo1, null);
                                    break;
                                }
                            }
                            else if (item.PropertyType.Name.StartsWith("Int64"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                addXml += item.GetValue(customInfo1, null);
                            }
                            else if (item.PropertyType.Name.StartsWith("Single"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                addXml += item.GetValue(customInfo1, null);
                            }
                            else if (item.PropertyType.Name.StartsWith("String"))
                            {
                                addXml += item.Name;
                                addXml += ":";

                                switch (item.Name)
                                {
                                case "Chengshibianhao":
                                case "Jubianhao":
                                case "Shiyongdanweibianhao":
                                {
                                    string temp = (string)item.GetValue(customInfo1, null);
                                    foreach (KeyValuePair <int, string> kvp in MainWindowViewModel._yingshelList)
                                    {
                                        if (kvp.Value == temp)
                                        {
                                            addXml += kvp.Key;
                                        }
                                    }
                                }
                                break;

                                case "IP":
                                {
                                    string    temp = (string)item.GetValue(customInfo1, null);
                                    IPAddress addr;
                                    if (customInfo1.IP != null && customInfo1.IP.Length != 0 && IPAddress.TryParse(temp, out addr))
                                    {
                                        addXml += (UInt32)(IPAddress.HostToNetworkOrder((Int32)Common.IpToInt(temp)));
                                    }
                                }
                                break;

                                case "Chuangjianshijian":
                                    addXml += Common.ConvertDateTimeInt(DateTime.Now);
                                    break;

                                default:
                                    addXml += item.GetValue(customInfo1, null);
                                    break;
                                }
                            }
                            else if (item.PropertyType.Name.StartsWith("Boolean"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                addXml += (i % 2 == 0) ? "0" : "1";
                            }
                            else
                            {
                                ;
                            }
                            addXml += ",";
                        }
                        addXml += ";";
                    }

                    if (tableName != null && tableName.Length != 0)
                    {
                        customInfo1.Xuhao = -1;
                        WorkServer.addTable(tableName, addXml, Marshal.GetFunctionPointerForDelegate(_addtablecallbackdelegate), true);
                        QueryShebeiguanli(null);
                    }
                }
            }
            break;

            case OperateEnum.OperateEnum_Modify:
            {
                string sqlStr = "update shebeiguanli set ";

                int begin = 0;
                foreach (KeyValuePair <int, string> kvp in MainWindowViewModel._yingshelList)
                {
                    if (kvp.Value == customInfo1.Chengshibianhao)
                    {
                        sqlStr += "Chengshibianhao='" + kvp.Key + "'";
                    }
                }

                foreach (KeyValuePair <int, string> kvp in MainWindowViewModel._yingshelList)
                {
                    if (kvp.Value == customInfo1.Jubianhao)
                    {
                        sqlStr += ",Jubianhao='" + kvp.Key + "'";
                    }
                    else if (kvp.Value == customInfo1.Shiyongdanweibianhao)
                    {
                        sqlStr += ",Shiyongdanweibianhao='" + kvp.Key + "'";
                    }
                }


                IPAddress addr;
                if (!string.IsNullOrEmpty(customInfo1.IP) && IPAddress.TryParse(customInfo1.IP, out addr))
                {
                    sqlStr += ",IP='" + (UInt32)(IPAddress.HostToNetworkOrder((Int32)Common.IpToInt(customInfo1.IP))) + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Shebeichangjia))
                {
                    sqlStr += ",Shebeichangjia='" + customInfo1.Shebeichangjia + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Shebeimingcheng))
                {
                    sqlStr += ",Shebeimingcheng='" + customInfo1.Shebeimingcheng + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Shebeileixing))
                {
                    sqlStr += ",Shebeileixing='" + customInfo1.Shebeileixing + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Jingdu))
                {
                    sqlStr += ",Jingdu='" + customInfo1.Jingdu + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Weidu))
                {
                    sqlStr += ",Weidu='" + customInfo1.Weidu + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Ruanjianxinxi))
                {
                    sqlStr += ",Ruanjianxinxi='" + customInfo1.Ruanjianxinxi + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Yingjianxinxi))
                {
                    sqlStr += ",Yingjianxinxi='" + customInfo1.Yingjianxinxi + "'";
                }

                sqlStr += " where ";
                int index = 0;
                foreach (var item in tableList)
                {
                    if (item.bSel)
                    {
                        if (index == 0)
                        {
                            sqlStr += " Shebeiguanli.[Xuhao]=" + item.Xuhao;
                        }
                        else
                        {
                            sqlStr += " or Shebeiguanli.[Xuhao]=" + item.Xuhao;
                        }

                        index++;
                    }
                }

                if (index >= 0)
                {
                    WorkServer.excuteSql(sqlStr, Marshal.GetFunctionPointerForDelegate(_excutesqlCallBackDelegate), true);
                    QueryShebeiguanli(null);
                }
            }
            break;
            }
        }
Exemple #22
0
 public void QueryBenyuebanliyewu(object obj)
 {
     _queryoperate = QueryOperate.QueryOperate_Yewu;
     WorkServer.QueryTable(MakeBenyuebanliyewuCurMonthQuerySql(obj, new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0)), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #23
0
 public void QueryTaiWanWangLai(object obj)
 {
     _queryoperate = QueryOperate.QueryOperate_Taiwan;
     WorkServer.QueryTable(MakeTaiWanWangLaiCurMonthQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #24
0
        private void Operate(object obj)
        {
            switch (operateenum)
            {
            case OperateEnum.OperateEnum_Add:
            {
                string tableName = "Guanliyuan";
                int    addCount  = 1;
                Random ran       = new Random();
                Type   type      = typeof(GUANLIYUANModel);

                if (type != null)
                {
                    System.Reflection.PropertyInfo[] properties = type.GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);

                    DateTime time   = DateTime.Now;
                    string   addXml = "";
                    for (int i = 0; i < addCount; ++i)
                    {
                        foreach (System.Reflection.PropertyInfo item in properties)
                        {
                            if (item.PropertyType.Name.StartsWith("Int32"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                switch (item.Name)
                                {
                                case "Xuhao":
                                    addXml += "0";
                                    break;

                                default:
                                    addXml += ran.Next().ToString();
                                    break;
                                }
                            }
                            else if (item.PropertyType.Name.StartsWith("Int64"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                addXml += ran.Next().ToString();
                            }
                            else if (item.PropertyType.Name.StartsWith("Single"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                addXml += ran.Next().ToString();
                            }
                            else if (item.PropertyType.Name.StartsWith("String"))
                            {
                                addXml += item.Name;
                                addXml += ":";

                                switch (item.Name)
                                {
                                case "Youxiaoqikaishi":
                                case "Youxiaoqijieshu":
                                    addXml += Common.ConvertDateTimeInt(DateTime.Parse((string)item.GetValue(customInfo1, null)));

                                    break;

                                default:
                                    addXml += item.GetValue(customInfo1, null);
                                    break;
                                }
                            }
                            else if (item.PropertyType.Name.StartsWith("Boolean"))
                            {
                                addXml += item.Name;
                                addXml += ":";
                                addXml += (i % 2 == 0) ? "0" : "1";
                            }
                            else
                            {
                                ;
                            }
                            addXml += ",";
                        }
                        addXml += ";";
                    }

                    if (tableName != null && tableName.Length != 0)
                    {
                        WorkServer.addTable(tableName, addXml, Marshal.GetFunctionPointerForDelegate(_addtablecallbackdelegate), true);
                        QueryYongHuguanli(null);
                    }
                }
            }
            break;

            case OperateEnum.OperateEnum_Modify:
            {
                string sqlStr = "update Guanliyuan set ";


                if (!string.IsNullOrEmpty(customInfo1.Yonghuming))
                {
                    sqlStr += "Yonghuming='" + customInfo1.Yonghuming + "'";
                }
                else
                {
                    return;
                }

                if (!string.IsNullOrEmpty(customInfo1.Mima))
                {
                    sqlStr += ",Mima='" + customInfo1.Mima + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Youxiaoqikaishi))
                {
                    sqlStr += ",Youxiaoqikaishi='" + Common.ConvertDateTimeInt(DateTime.Parse(customInfo1.Youxiaoqikaishi)) + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Youxiaoqijieshu))
                {
                    sqlStr += ",Youxiaoqijieshu='" + Common.ConvertDateTimeInt(DateTime.Parse(customInfo1.Youxiaoqijieshu)) + "'";
                }

                if (!string.IsNullOrEmpty(customInfo1.Quanxianjibie))
                {
                    sqlStr += ",Quanxianjibie='" + customInfo1.Quanxianjibie + "'";
                }

                sqlStr += " where ";
                int index = 0;
                foreach (var item in tableList)
                {
                    if (item.bSel)
                    {
                        if (index == 0)
                        {
                            sqlStr += " Guanliyuan.[Xuhao]=" + item.Xuhao;
                        }
                        else
                        {
                            sqlStr += " or Guanliyuan.[Xuhao]=" + item.Xuhao;
                        }

                        index++;
                    }
                }

                WorkServer.excuteSql(sqlStr, Marshal.GetFunctionPointerForDelegate(_excutesqlCallBackDelegate), true);
                QueryYongHuguanli(null);
            }
            break;
            }
        }
Exemple #25
0
 public void QuerySheBeiZaiXian(object obj)
 {
     _queryoperate = QueryOperate.QueryOperate_SheBeiZaiXian;
     WorkServer.queryOnlieDevCnt(Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }
Exemple #26
0
 private void StopServer(object obj)
 {
     WorkServer.stopServer();
 }
Exemple #27
0
        public void Logon(object obj)
        {
            if (logonName == null || logonName.Length == 0)
            {
                displayMsg = "用户名不能为空!";
                return;
            }
            if (logonPassword == null || logonPassword.Length == 0)
            {
                displayMsg = "密码不能为空!";
                return;
            }

            if (WorkServer.startClient(IP, port, bDevice))
            {
                bOnline    = true;
                displayMsg = "连接服务端成功!";
                _DeviceManageViewModel._UserViewModel.DoLogon();

                if (_DeviceManageViewModel._UserViewModel._guliyuanList.Keys.Count > 0)
                {
                    if (_DeviceManageViewModel._UserViewModel._guliyuanList.Keys.Contains(logonName))
                    {
                        if (_DeviceManageViewModel._UserViewModel._guliyuanList[logonName].Mima == logonPassword)
                        {
                            BackgroundWorker bgw = new BackgroundWorker();
                            bgw.WorkerSupportsCancellation = true;
                            bgw.WorkerReportsProgress      = true;

                            bgw.DoWork += (object sender, DoWorkEventArgs e) => {
                                int progress = 0;
                                displayMsg = "0" + "%";

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                    QueryYingshebiao(null);
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                    _DeviceManageViewModel._DevicemaViewModel.DoLogon();
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                    _DeviceManageViewModel._UpgradeViewModel.DoLogon();
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                    _WebBrowserViewMode.DoLogon();
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                Application.Current.Dispatcher.Invoke(
                                    new Action(() =>
                                {
                                }));
                                progress += 10;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);

                                progress = 100;
                                (sender as BackgroundWorker).ReportProgress(progress);
                                Thread.Sleep(100);
                            };
                            bgw.ProgressChanged += (object sender, ProgressChangedEventArgs e) =>
                            {
                                progressValue = e.ProgressPercentage;
                                displayMsg    = e.ProgressPercentage + "%";
                            };
                            bgw.RunWorkerCompleted += (object sender, RunWorkerCompletedEventArgs e) =>
                            {
                                WebBrowserShow(null);

                                progressValue = 0;
                                displayMsg    = "";
                            };

                            bgw.RunWorkerAsync();
                        }
                        else
                        {
                            displayMsg = "密码错误!";
                        }
                    }
                    else
                    {
                        displayMsg = "不存在的用户!";
                    }
                }
                else
                {
                    displayMsg = "数据库用户表为空!";
                }
            }
            else
            {
                displayMsg = "连接服务端失败!";
            }
        }
Exemple #28
0
        public void Loaded(object obj)
        {
            return;

            new Thread(() =>
            {
                WorkServer.startClient(IP, port, true);

                Application.Current.Dispatcher.Invoke(
                    new Action(() =>
                {
                    _DeviceManageViewModel._UserViewModel.DoLogon();
                }));

                Application.Current.Dispatcher.Invoke(
                    new Action(() =>
                {
                    QueryYingshebiao(null);
                }));

                Application.Current.Dispatcher.Invoke(
                    new Action(() =>
                {
                    _DeviceManageViewModel._DevicemaViewModel.DoLogon();
                }));

                Application.Current.Dispatcher.Invoke(
                    new Action(() =>
                {
                    _DeviceManageViewModel._UpgradeViewModel.DoLogon();
                }));

                Application.Current.Dispatcher.Invoke(
                    new Action(() =>
                {
                    _WebBrowserViewMode.DoLogon();
                }));

                // Application.Current.Dispatcher.Invoke(
                //new Action(() =>
                //{
                //    _DeviceManageViewModel._NetViewModel.DoLogon();
                //}));

                // Application.Current.Dispatcher.Invoke(
                //new Action(() =>
                //{
                //    _DeviceManageViewModel._AbnormalViewModel.DoLogon();
                //}));

                //Application.Current.Dispatcher.Invoke(
                //new Action(() =>
                //{
                //    _DeviceManageViewModel._HardwareViewModel.DoLogon();
                //}));
            }).Start();


            //_SummaryStatViewModel.DoLogon();
            //_SignStatViewModel.DoLogon();
            //_SignAnomalyStatViewModel.DoLogon();
        }
Exemple #29
0
 public void Query(object obj)
 {
     tableList.Clear();
     _tableListTemp.Clear();
     WorkServer.QueryTable(MakeQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate));
 }
Exemple #30
0
 public void QueryGuanLiCiShu(object obj)
 {
     _queryoperate = QueryOperate.QueryOperate_GuanLiCnt;
     WorkServer.QueryTable(MakeGuanLiCiShuQuerySql(obj), Marshal.GetFunctionPointerForDelegate(_querytablecallbackdelegate), true);
 }