public MainViewModel()
 {
     IocHelper.EnsureIocKey(this);
     stringResource = ViewModelLocatorBase.StringResources;
     ViewItems      = new ObservableCollection <ViewItem>
     {
         new ViewItem(stringResource.GetString("HomeText"), (char)0xE10F, string.Empty, HomePageId),
         new ViewItem(stringResource.GetString("ContentText"), (char)0xE132, string.Empty, ContentPageId),
         new ViewItem(stringResource.GetString("MakeContentTitle"), (char)0xE11F, string.Empty, SendContentPageId),
         new ViewItem(stringResource.GetString("MsgPageText"), (char)0xE119, string.Empty, MsgPageId),
     };
     //注册消息服务
     MsgHandle.Add(ShowMsgKey, ShowMsgHandle);
 }
Exemple #2
0
        public HomeViewModel()
        {
            apiManager    = SimpleIoc.Inst.GetInstance <WebApiManager>(ViewModelLocatorBase.ApiManagerKey);
            accountHelper = SimpleIoc.Inst.GetInstance <ISettingHelper>(ViewModelLocatorBase.AccountSettingKey);
            appResources  = SimpleIoc.Inst.GetInstance <IStringResource>(ViewModelLocatorBase.StringReourceKey);
            UserName      = accountHelper.GetValue <string>(UserNameKey);
            Pwd           = accountHelper.GetValue <string>(PwdKey);
            LoginCommand  = new RelayCommand(Login);
            LogOffCommand = new RelayCommand(LogOff);
            IocHelper.EnsureIocKey(this);
#if DEBUG
            UserName = "******";
            Pwd      = "Asdfg123456";
#endif
        }
Exemple #3
0
        public ViewModelLocatorBase()
        {
            SimpleIoc.Inst.RegisterClass <WebApiManager>(ApiManagerKey);
            InitPlatformService();
            SimpleIoc.Inst.AddInstance(ViewModelLocatorKey, this);

            MainViewModel          = SimpleIoc.Inst.RegisterClass <MainViewModel>(MainViewModel.MainViewModelKey);
            HomeViewModel          = SimpleIoc.Inst.RegisterClass <HomeViewModel>(HomeViewModel.HomeViewModelKey);
            ContentViewModel       = SimpleIoc.Inst.RegisterClass <ContentViewModel>(ContentViewModel.ContentViewModelKey);
            MsgViewModel           = SimpleIoc.Inst.RegisterClass <MsgViewModel>(MsgViewModel.MsgViewModelKey);
            SendContentViewModel   = SimpleIoc.Inst.RegisterClass <SendContentViewModel>(SendContentViewModel.SendContentViewModelKey);
            ContentDetailViewModel = SimpleIoc.Inst.RegisterClass <ContentDetailViewModel>(ContentDetailViewModel.ContentDetailViewModelKey);

            IocHelper.EnsureIocKey(this);
            IocHelper.EnsureIocInst(this);//确保服务已经装载
        }
Exemple #4
0
 public ContentViewModel()
 {
     LocalPage            = 0;
     IsNotWebConnecting   = false;
     ParWidth             = _ParWidth;
     apiManager           = SimpleIoc.Inst.GetInstance <WebApiManager>(ViewModelLocatorBase.ApiManagerKey);
     appResources         = SimpleIoc.Inst.GetInstance <IStringResource>(ViewModelLocatorBase.StringReourceKey);
     Contents             = new ObservableCollection <Content>();
     IsNotWebConnecting   = true;
     UpdateContentCommand = new RelayCommand(UpdateContent);
     SearchContentCommand = new RelayCommand(SearchContent);
     NextPageCommand      = new RelayCommand(NextPage);
     PrevPageCommand      = new RelayCommand(PrevPage);
     IocHelper.EnsureIocKey(this);
     MsgHandle.Add(SetVisitContentKey, SetVisitContent);
     MsgHandle.Add(SetLeftPartVisibilityKey, SetLeftPartVisibility);
 }
 public ContentDetailViewModel()
 {
     IocHelper.EnsureIocKey(this);
     apiManager             = SimpleIoc.Inst.GetInstance <WebApiManager>(ViewModelLocatorBase.ApiManagerKey);
     appResources           = SimpleIoc.Inst.GetInstance <IStringResource>(ViewModelLocatorBase.StringReourceKey);
     ContentStack           = new Stack <Content>();
     Comments               = new ObservableCollection <RelComment>();
     GoBackCommand          = new RelayCommand(GoBack);
     UpdateCommentCommand   = new RelayCommand(UpdateComment);
     PrevPageCommand        = new RelayCommand(PrevPage);
     NextPageCommand        = new RelayCommand(NextPage);
     SendCommentCommand     = new RelayCommand(SendComment);
     NavToCommentCommand    = new RelayCommand(NavToComment);
     GoBackToContentCommand = new RelayCommand(GoBackToContent);
     HasPrev   = false;
     PreSymbol = (char)0xE112;
 }
 public NavigationHelper()
 {
     IocHelper.EnsureIocKey(this);
 }