Exemple #1
0
        private MainViewModel()
        {
            _command = new DelegateCommand<string>(Excute);//, CanExcute);
            //
            using (var client = new QueueClientSoapClient())
            {
                _SysParaConfigObj = client.GetSysParamConfigOR();
            }

            InitData();

            //刷新队列
            //定时更新值
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 5);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }
        private bool Init()
        {
            try
            {
                BussinessList = new ObservableCollection<BussinessQueueOR>();
                var v = WebViewModel.Instance.GetQueues();
                foreach (BussinessQueueOR obj in v)
                {
                    BussinessList.Add(obj);
                }

                //获取退出密码
                Userpsw = ImgSetViewModel.Instance.GetPwd();
                if (string.IsNullOrEmpty(Userpsw))
                    Userpsw = "ABCabc123";

                //参数设置
                using (var client = new QueueClientSoapClient())
                {
                    _SysParaConfigObj = client.GetSysParamConfigOR();
                    _ShutdownTimeObj = client.SelectShutdownTime();
                }

                if (_ShutdownTimeObj != null)
                {
                    //MessageBox.Show(_ShutdownTimeObj.Mondaytime);
                    ShutDownInit();
                }
                //处理、硬件信息
                _HDHead=new DeviceCheckHead();

                thHDandPJQ = new Thread(_HDHead.HDMain);
                thHDandPJQ.IsBackground = true;
                thHDandPJQ.Start();
            }
            catch (EndpointNotFoundException exEnd)
            {
                ShowErrorMsg("配置Web服务不存在!");
                return false;
            }
            catch (Exception ex)
            {
                ShowErrorMsg("获取业务类型出错:Webservice未启动,或配置错误!\r\n详细信息:" + ex.Message);
                return false;
            }

            LoadButton(string.Empty);
            return true;
        }