Exemplo n.º 1
0
        /// <summary>
        /// 显示工具
        /// </summary>
        /// <param name="type"></param>
        public void showTools(ToolsType type)
        {
            listTool.Clear();

            // 获取工具
            listTool = mToolManager.GetAllTools((int)type);
            PropertyChanging("listTool");
        }
Exemplo n.º 2
0
        public MainViewModel()
        {
            // 初始化
            this.CurrentDevice = null;

            this.RegisterChild <MainHomeViewModel>(() => new MainHomeViewModel());
            this.RegisterChild <MainDataViewModel>(() => new MainDataViewModel());
            this.RegisterChild <MainToolViewModel>(() => new MainToolViewModel());
            this.RegisterChild <MainSettingViewModel>(() => new MainSettingViewModel());

            this.SelectedChild = GetChild(typeof(MainHomeViewModel));

            // 苹果设备初始化
            try
            {
                i_Connect       = new ConnectEventHandler(iPhoneConnected);
                i_DisConnect    = new ConnectEventHandler(iPhoneDisconnected);
                iPhoneInterface = new iPhone(i_Connect, i_DisConnect);
            }
            catch (Exception ex)
            {
                saveErrorLog(ex.Message);
                saveErrorLog(ex.HelpLink);
                saveErrorLog(ex.StackTrace);
                saveErrorLog(ex.TargetSite.ToString());
            }

            //
            // 用户
            //
            string      msg  = "";
            UserManager um   = new UserManager();
            User        user = um.Login("admin", "ecryan", out msg);

            if (user == null)
            {
                MessageBox.Show(msg);
                return;
            }
            else
            {
                //保存登录人信息
                User.LoginUser = user;
                setLanguage();
            }

            // 加载附件工具
            var toolManager = new ToolManager();

            mlistTool = toolManager.GetAllTools((int)ToolsType.Other);
        }