Beispiel #1
0
        private void AddTableCallBack(string resultStr, string errorStr)
        {
            if (errorStr != null && errorStr.Length != 0)
            {
                displayMsg = errorStr;
            }
            else
            {
                if (string.IsNullOrEmpty(resultStr))
                {
                    Angle = 360 + -130;
                }
                else
                {
                    string[] rows = resultStr.Split(';');
                    foreach (string row in rows)
                    {
                        if (row.Length > 0)
                        {
                            ZHIQIANSHUJUModel model = new ZHIQIANSHUJUModel();

                            string[] cells = row.Split(',');
                            foreach (string cell in cells)
                            {
                                string[] keyvalue = cell.Split(':');
                                if (keyvalue.Length != 2 || keyvalue[1] == null || keyvalue[1].Length == 0)
                                {
                                    continue;
                                }

                                if (keyvalue[0] == "progress")
                                {
                                    double progress = Convert.ToDouble(keyvalue[1]);

                                    Angle = progress * 3.6 + -130;
                                    Debug.WriteLine(progress);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void UpgradeCallBack(string resultStr, string errorStr)
        {
            if (errorStr != null && errorStr.Length != 0)
            {
                MessageBox.Show(errorStr);
            }
            else
            {
                if (string.IsNullOrEmpty(resultStr))
                {
                    Angle = 360 + -130;
                }
                else
                {
                    string[] rows = resultStr.Split(';');
                    foreach (string row in rows)
                    {
                        if (row.Length > 0)
                        {
                            ZHIQIANSHUJUModel model = new ZHIQIANSHUJUModel();

                            string[] cells = row.Split(',');
                            foreach (string cell in cells)
                            {
                                string[] keyvalue = cell.Split(':');
                                if (keyvalue.Length != 2 || keyvalue[1] == null || keyvalue[1].Length == 0)
                                {
                                    continue;
                                }

                                if (keyvalue[0] == "downloadprogress")
                                {
                                    double progress = Convert.ToDouble(keyvalue[1]);

                                    Angle = progress * 3.6 + -130;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public void QueryTableCallBack(string resultStr, string errorStr)
        {
            System.Reflection.PropertyInfo[] properties = typeof(ZHIQIANSHUJUModel).GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);

            string[] rows = resultStr.Split(';');
            foreach (string row in rows)
            {
                if (row.Length > 0)
                {
                    ZHIQIANSHUJUModel model = new ZHIQIANSHUJUModel();

                    string[] cells = row.Split(',');
                    foreach (string cell in cells)
                    {
                        string[] keyvalue = cell.Split(':');
                        if (keyvalue.Length != 2 || keyvalue[1] == null || keyvalue[1].Length == 0)
                        {
                            continue;
                        }

                        foreach (System.Reflection.PropertyInfo item in properties)
                        {
                            if (item.Name == keyvalue[0])
                            {
                                if (item.PropertyType.Name.StartsWith("Int32"))
                                {
                                    item.SetValue(model, Convert.ToInt32(keyvalue[1]), null);
                                }
                                else if (item.PropertyType.Name.StartsWith("Int64"))
                                {
                                    item.SetValue(model, Convert.ToInt64(keyvalue[1]), null);
                                }
                                else if (item.PropertyType.Name.StartsWith("String"))
                                {
                                    switch (item.Name)
                                    {
                                    case "Chengshibianhao":
                                    case "Jubianhao":
                                    case "Shiyongdanweibianhao":
                                    case "Shebeibaifangweizhi":
                                    case "Qianzhuzhonglei":
                                    case "ZhikaZhuangtai":
                                    case "Zhengjianleixing":
                                    case "Xingbie":
                                    case "Yewuleixing":
                                        if (MainWindowViewModel._yingshelList.Keys.Contains(Convert.ToInt32(keyvalue[1])))
                                        {
                                            item.SetValue(model, MainWindowViewModel._yingshelList[Convert.ToInt32(keyvalue[1])], null);
                                        }
                                        break;

                                    case "Riqi":
                                    case "Chushengriqi":
                                    case "Jiaoyiriqi":
                                        DateTime datetime = Common.ConvertIntDateTime(Convert.ToInt64(keyvalue[1]));
                                        item.SetValue(model, datetime.ToShortDateString(), null);
                                        break;

                                    case "IP":
                                        item.SetValue(model, Common.IntToIp(IPAddress.NetworkToHostOrder((Int32)Convert.ToInt64(keyvalue[1]))), null);
                                        break;

                                    default:
                                        item.SetValue(model, keyvalue[1], null);
                                        break;
                                    }
                                }
                                else if (item.PropertyType.Name.StartsWith("Boolean"))
                                {
                                    item.SetValue(model, Convert.ToBoolean(Convert.ToInt32(keyvalue[1])), null);
                                }
                                else
                                {
                                    ;
                                }
                                break;
                            }
                        }
                    }
                    _tableListTemp.Add(model);
                }
            }
            Application.Current.Dispatcher.Invoke(
                new Action(() =>
            {
                ShowPage(1);
            }));
        }