Inheritance: MvxCommandBase, IMvxCommand
        public AppSettingEdit_ViewModel_WPF(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogService DialogService_,
            EFDbConnect EFDbConnect_)
        {

            if (!IsInDesignModeNet())
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                EFDbConnect = EFDbConnect_;

                Languages = new ObservableCollection<Language>(EFDbConnect.Table<Language>().ToList()); 
                LearningWordStrategies = new ObservableCollection<LearningWordStrategy>(EFDbConnect.Table<LearningWordStrategy>().ToList());

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignModeNet())
            {
                Languages = new ObservableCollection<Language>();
                Languages.Add(new Language() {Code="en",Name="English"});
                Languages.Add(new Language() {Code="ru",Name="Русский"});
                Languages.Add(new Language() {Code="ua",Name="Українська мова"});

                Languages[0].DictionariesCollection.Add(new Dictionary {Name="First dictionary" });
                Languages[0].DictionariesCollection.Add(new Dictionary {Name="Ordinary dict" });
                Languages[0].DictionariesCollection.Add(new Dictionary {Name="My dictionary" });

                CurrentLanguage = Languages[0];
            }

        }
        public Login_ViewModel(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSettings_
            )
        {
            Logger = Logger_;
            NavigationService = NavigationService_;
            DialogService = DialogService_;
            AppSettings = AppSettings_;

            if (!IsInDesignMode)
            {
                Login_Command = new MvxCommand(Login_cmd);
            }
            

            if (IsInDesignMode)
            {

            }


        }
        public DictionariesList_ViewModel(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogService DialogService_,
            EFDbConnect EFDbConnect
            ) : base ()
        {
            NavigationService = NavigationService_;

            if (IsInDesignModeNet())
            {
                Dictionaries = new ObservableCollection<Dictionary>();

                Dictionary dic1 = new Dictionary { Name = "First" };
                Dictionaries.Add(dic1);

                Dictionary dic2 = new Dictionary { Name = "Second" };
                Dictionaries.Add(dic2);
            }
            else
            {
                List<Dictionary> dcts = EFDbContext.Context.Query(new QueryBuilder<Dictionary>(EFDbConnect));
                Dictionaries = new ObservableCollection<Dictionary>(dcts);
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
                OpenDictionary_Command = new MvxCommand<Dictionary>(OpenDictionary);
            }
        }
        public SaveChanges_ViewModel(ILogger Logger_, INavigationService NavigationService_)
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignMode)
            {
                LearningItem li1 = new LearningItem { Name = "Mazzy" };
                LearningItem li2 = new LearningItem { Name = "Futurama" };

                Changes = new ObservableCollection<Entity>
                {
                    new Entity {
                        HardReference = li1,
                        Obj = new WeakReference<Base>(li1),
                        Order = 1,
                        State = Entity.EntityState.Added,
                        Type = li1.GetType()
                    },
                    new Entity {
                        HardReference = li2,
                        Obj = new WeakReference<Base>(li2),
                        Order = 2,
                        State = Entity.EntityState.Added,
                        Type = li1.GetType()
                    }
                };
            }

        }
 public MappingsOverviewViewModel()
 {
     _okCommand = new MvxCommand<List<Mapping>>(list =>
     {
         Mvx.Resolve<IDataExchangeService>().Payload[Constants.MappingsKey] = _mappingsForDownload;
         Close(this);
     });
     RefreshRemoteMappings();
 }
 public ProgressBar_Model() : base () {
     IsIndeterminate = false;
     Minimum = 0;
     Maximum = 100;
     Value = 0;
     if (!ViewModel_Base.IsInDesignModeStatic)
     {
         Command_Cancel = new MvxCommand(()=>IsCanceled=true);
     }
 }
        public EditLearningItem_ViewModel_WPF(
            IDialogServiceExtended DialogService_, 
            IPlayer Player_,
            INavigationService NavigationService_,
            AppSetting AppSetting_,
            EFDbConnect EFDbConnect_)
        {
            
            if (!IsInDesignModeNet())
            {
                DialogService = DialogService_;
                Player = Player_;
                NavigationService = NavigationService_;
                AppSetting = AppSetting_;
                EFDbConnect = EFDbConnect_;

                Languages = new ObservableCollection<Language>(EFDbConnect.Table<Language>().ToList());

                // Commands
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

            }

            PlayerVisibility = Visibility.Visible;
            DownloadVideoButton = new ButtonModel();

            if (IsInDesignModeNet())
            {
                LearningItem = new LearningItem();
                LearningItem.Name = "Mazzy in Gondoland";
                
                LearningItem.VideoFileName = "C:\\Users\\Public\\Videos\\Sample Videos\\Mazzy.mkv";

                LearningItem.SubtitleCollection = new SynchronizedObservableCollection<Subtitles>();

                LearningItem.SubtitleCollection.Add(new Subtitles           {
                    Name = "English-Russian"
                });

                LearningItem.SubtitleCollection.Add(new Subtitles
                {
                    Name = "English-Ukraine"
                });

                //CurrentSubtitles = LearningItem.SubtitleCollection[0];
                
            }

           
        }
        public SubWordEditor_ViewModel(ILogger Logger_, INavigationService NavigationService_, IDialogService DialogService_)
        {
            Logger = Logger_;
            NavigationService = NavigationService_;
            DialogService = DialogService_;

            CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

            if (IsInDesignMode)
            {
                Word = new WordOfSubtitleItem();
                Word.word = "Test";
            }

        }
Esempio n. 9
0
        /// <summary>
        ///     Creates an AboutViewModel Object
        /// </summary>
        /// <param name="appInformation">Instance of a <see cref="IAppInformation" /> implementation.</param>
        /// <param name="composeEmailTask">Instance of a <see cref="IMvxComposeEmailTask" /> implementation.</param>
        /// <param name="webBrowserTask">Instance of a <see cref="IMvxWebBrowserTask" /> implementation.</param>
        /// <param name="storeFeatures">Instance of a <see cref="IStoreFeatures" /> implementation.</param>
        public AboutViewModel(IAppInformation appInformation,
            IMvxComposeEmailTask composeEmailTask,
            IMvxWebBrowserTask webBrowserTask,
            IStoreFeatures storeFeatures)
        {
            this.appInformation = appInformation;
            this.composeEmailTask = composeEmailTask;
            this.webBrowserTask = webBrowserTask;
            this.storeFeatures = storeFeatures;

            GoToWebsiteCommand = new MvxCommand(GoToWebsite);
            SendMailCommand = new MvxCommand(SendMail);
            RateAppCommand = new MvxCommand(RateApp);
            GoToRepositoryCommand = new MvxCommand(GoToRepository);
        }
        public InitialWizard_ViewModel_WPF(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogServiceExtended DialogService_,
            AppSetting AppSettings_,
            EFDbConnect EFDbConnect_,
            ObservableCollection<Language> languages_
            ) : base ()
        {

            PanelCount = 1;

            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSettings_;
                EFDbConnect = EFDbConnect_;
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

                //List<Language> lst = EFDbConnect.Table<Language>().ToList();
                //Languages = new ObservableCollection<Language>(lst);
                Languages = languages_;

                // Default values
                TargetLanguage = Languages.FirstOrDefault(x=>x.Code == "en");
                NativeLanguage = Languages.FirstOrDefault(x=>x.Code == System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag.Substring(0,2).ToLower());

                LearningWordStrategy strat = EFDbContext.Context.FirstOrDefault<LearningWordStrategy>();
                AppSettings.LearningWordStrategy = strat;

            }

            Drives = FileService.GetFixedDrivesList();
            if (Drives.Count > 0)
            {
                DriveForData = Drives.OrderByDescending(x => x.AvailableFreeSpace).FirstOrDefault();
            }

            if (IsInDesignMode)
            {
                SelectedIndex = 2;
                UpdateButtonState();
            }


        }
Esempio n. 11
0
        public Backup_ViewModel(ILogger Logger_, INavigationService NavigationService_, IDialogServiceExtended DialogService_)
        {
            Logger = Logger_;
            NavigationService = NavigationService_;
            DialogService = DialogService_;

            Files = new ObservableCollection<string>();
            CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

            if (IsInDesignMode)
            {
                Files.Add(Environment.CurrentDirectory);
                Files.Add(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
            }

        }
        public MainWindow_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IStore Store_,
            ILocalization Loc_,
            ILogger logger_) : base()
        {

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSetting_;
                Store = Store_;
                Tx = Loc_;
                logger = logger_;

               
                //OpenCommand = new MvxCommand<LearningItem>(Open);
                DeleteCommand = new MvxCommand<LearningItem>(Delete);
                //EditCommand = new MvxCommand<LearningItem>(Edit);
                OpenDictionary_Command = new MvxCommand(OpenDictionary_Cmd);
                OpenAppSetting_Command = new MvxCommand(OpenAppSetting_Cmd);
                Training_Command = new MvxCommand(Training_Cmd);

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }
            
            if (IsInDesignMode)
            {
                AppSettings = new AppSetting();

                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Mazzy in Gondoland" }
                    ); 
                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Lego movies" }
                    ); 
                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Futurama" }
                    );

            }
            

        }
        public StandartDialog_ViewModel(ILogger Logger_, INavigationService NavigationService_)
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignMode)
            {
                Title = "Hello!";
                Body = "How's it going ?";

            }

        }
        public Download_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IStore Store_,
            ILocalization Loc_,
            ILogger logger_) : base()
        {

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSetting_;
                Store = Store_;
                Tx = Loc_;
                logger = logger_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
                Command_DownloadStoreItem = new MvxCommand<StoreItemExt>((x)=>CmdDispatcher_StoreItem(x,"Download"));
            }
            
            StoreItems = new SynchronizedObservableCollection<StoreItemExt>();
            
            if (IsInDesignMode)
            {

                StoreItemExt item;

                item = new StoreItemExt { Name = "South Park" };
                item.DownloadButton.State1 = true;
                StoreItems.Add(item);

                item = new StoreItemExt { Name = "Chuggington" };
                item.DownloadButton.State2 = true;
                StoreItems.Add(item);

                item = new StoreItemExt { Name = "Futurama" };
                item.DownloadButton.State3 = true;
                StoreItems.Add(item);

            }
            

        }
        public LearningItemSettings_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_)
        {
            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            TestingUnderstandingNewWords_VM = new VisualElement_Model();

            if (IsInDesignMode)
            {
                LearningItem = new LearningItem();
                LearningItem.ShowNewWords = true;
            }
        }
        private void Loaded()
        {
            EditCommand = null;

            AllPayments.Clear();
            foreach (var payment in paymentRepository.LoadRecurringList())
            {
                AllPayments.Add(payment);
            }

            Source = new ObservableCollection<AlphaGroupListGroup<Payment>>(
                AlphaGroupListGroup<Payment>.CreateGroups(AllPayments,
                    CultureInfo.CurrentUICulture,
                    s => s.ChargedAccount.Name));

            //We have to set the command here to ensure that the selection changed event is triggered earlier
            EditCommand = new MvxCommand<Payment>(Edit);
        }
        public ReferencesToWord_ViewModel(
            ILogger Logger_, 
            INavigationService NavigationService_,
            EFDbContext EFDbContext_,
            IDialogService DialogService_,
            ILocalization Tx_
            )
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                EFDbContext =EFDbContext_;
                DialogService = DialogService_;
                Tx = Tx_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

                References = new ObservableCollection<ReferenceToWordOfDictionary>();
            }

            ClearButton = new ButtonModel();
                      

            if (IsInDesignMode)
            {
                Word = new WordOfDictionary { word_of_dictionary = "I'm" };

                LearningItem li1 = new LearningItem { Name = "Mazzy collection" };
                LearningItem li2 = new LearningItem { Name = "Futurama season 1" };

                Subtitles st1 = new Subtitles { Name = "English - Russian" };
                Subtitles st2 = new Subtitles { Name = "English - Ukraine" };

                References = new ObservableCollection<ReferenceToWordOfDictionary>()
                {
                    new ReferenceToWordOfDictionary {LearningItem = li1, Subtitles = st1,SubtitleItem =  new SubtitleItem { Text = "I'm Mazzy"},WordOfSubtitleItem = new WordOfSubtitleItem { word = "I'm"} },
                    new ReferenceToWordOfDictionary {LearningItem = li1, Subtitles = st1, SubtitleItem = new SubtitleItem { Text = "I am princess Sylvia" } ,WordOfSubtitleItem = new WordOfSubtitleItem { word = "I am"}},
                    new ReferenceToWordOfDictionary {LearningItem = li2, Subtitles = st2, SubtitleItem = new SubtitleItem { Text = "I'm Nibbler" } ,WordOfSubtitleItem = new WordOfSubtitleItem { word = "I'm"}}
                };

            }

        }
        public WebBrowserForm_ViewModel(
            ILogger Logger_, 
            INavigationService NavigationService_
            )
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignMode)
            {
                Title = "Hello!";
            }

        }
 public MainWindow_ViewModel_WPF(
     INavigationService NavigationService_,
     IDialogServiceExtended IDialogServiceExtended_,
     AppSetting AppSetting_,
     IStore Store_,
     ILocalization loc_,
     ILogger logger_,
     IWebAPI_Authorization MainWebAPI_
     ) : base (NavigationService_,IDialogServiceExtended_,AppSetting_,Store_,loc_,logger_)
 {
     
     IDialogServiceExtended = IDialogServiceExtended_;
     MainWebAPI = MainWebAPI_;
     
     if(!IsInDesignModeNet())
     {
         AddCommand = new MvxCommand(Add);
         CommandDispatecherWPF = new MvxCommand<string>(CmdDispatcherWPF);
     }
  }
        public LoggerForm_ViewModel(ILogger Logger_, INavigationService NavigationService_)
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignMode)
            {
                LogList = new List<LogMessage>()
                {
                    new LogMessage { id = 1,message = "Test message from file",filepath=@"D:\C#\Src\Frameworks\MvvmCross-4.0",linenumber=21,methodName="Test",mstype = LogMsgType.Trace },
                    new LogMessage { id = 2,message = "Test message from file",filepath=@"D:\C#\Src\Frameworks\MvvmCross-4.0",linenumber=21,methodName="Test",mstype = LogMsgType.Trace },
                };
            }

        }
        public Publish_ViewModel_WPF(
            ILogger Logger_, 
            INavigationService NavigationService_,
            IDialogService DialogService_,
            IPublish iPublish_)
        {
            if (!IsInDesignModeNet())
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                iPublish = iPublish_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

            } else
            {
                LearningItem = new LearningItem { Name = "Futurama" };
            }

        }
        public UnderstandingTest_ViewModel(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IAudioAPI AudioAPI_,
            IMvxMessenger Messenger_,
            ISpeechAPI SpeechAPI_,
            ILocalization Loc_
            )
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSetting = AppSetting_;
                AudioAPI = AudioAPI_;
                Messenger = Messenger_;
                SpeechAPI = SpeechAPI_;
                Loc = Loc_;

                Speak_Command = new MvxCommand(Speak_cmd);
                PressWordButton_Command = new MvxCommand<ButtonModel>(PressWordButton_Cmd);
            }

            ButtonsCollection = new ObservableCollection<ButtonModel>();

            if (IsInDesignMode)
            {
                string[] tarr = {
                    "Good news everyone !\nLine1\nLine2",
                    "What's happening here ?\nLine1",
                    "Hello world!" };
                for(int i = 0; i < 3; i++) ButtonsCollection.Add(new ButtonModel() {Text = tarr[i] });
                CurrentSub = new SubtitleItem() {
                    Text = "This is current subtitles item.\nLine 2\nLine3" };
            }

        }
        public ListOfWordsOfDictionary_ViewModel_WPF(ILogger Logger_, INavigationService NavigationService_, IDialogService DialogService_)
        {
            Logger = Logger_;
            NavigationService = NavigationService_;
            DialogService = DialogService_;

            ListOfWords = new ObservableCollection<DataGridItem>();

            if (!IsInDesignModeNet())
            {
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignModeNet())
            {
                Dictionary dic = new Dictionary { Name = "Simple dictionary" };
                Dictionary dic1 = new Dictionary { Name = "Other dictionary" };
                
                ListOfWords.Add(new DataGridItem { Word = new WordOfDictionary { word_of_dictionary = "Hello" },Dictionary = dic });
                ListOfWords.Add(new DataGridItem { Word = new WordOfDictionary { word_of_dictionary = "White" },Dictionary = dic1,Analogy = new WordOfDictionary { word_of_dictionary = "White" } });
                ListOfWords.Add(new DataGridItem { Word = new WordOfDictionary { word_of_dictionary = "to run" } ,Dictionary = dic});
            }

        }
        public AddNewLearningItemWizard_ViewModel(ILogger Logger_, INavigationService NavigationService_, IDialogService DialogService_) : base ()
        {

            PanelCount = 4;

            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
            }

            CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

            if (IsInDesignMode)
            {
                SelectedIndex = 2;
                UpdateButtonState();
                LearningItem = new LearningItem();
            }

            

        }
        public ExceptionForm_ViewModel(ILogger Logger_, INavigationService NavigationService_)
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignMode)
            {
                Title = "Hello!";
                Message = "How's it going ?";
                try
                {
                    throw new Exception();
                }
                catch(Exception ex)
                {
                    BodyOfException = ex.StackTrace;
                }
            }

        }
 public ModalViewModel()
 {
     CloseCommand = new MvxCommand(() => Close(this));
 }
Esempio n. 27
0
        public void NavigateToInitialForm()
        {
            NavigationBack = new MvxCommand(NavigateBack_cmd);
            App.MainMetroWindow.Closing += MainMetroWidow_Closing;
            CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

            NavigationService = Mvx.Resolve<INavigationService>();
            //NavigationService.NavigateForward(Views.Login);

            AppSetting AppSettings = EFDbContext.Context.FirstOrDefault<AppSetting>();
            NavigationService.NavigateForward(Views.MainWindow);
            if (AppSettings.isFirstStart)
            {
                NavigationService.OpenDialog(Views.InitialWizard,new InitialWizard_parameters());
            }

        }
        private void LoadPayments()
        {
            EditCommand = null;
            //Refresh balance control with the current account
            BalanceViewModel.UpdateBalanceCommand.Execute();

            RelatedPayments = new ObservableCollection<Payment>(paymentRepository
                .GetRelatedPayments(accountRepository.Selected)
                .OrderByDescending(x => x.Date)
                .ToList());

            Source = new ObservableCollection<DateListGroup<Payment>>(
                DateListGroup<Payment>.CreateGroups(RelatedPayments,
                    CultureInfo.CurrentUICulture,
                    s => s.Date.ToString("MMMM", CultureInfo.InvariantCulture) + " " + s.Date.Year,
                    s => s.Date, true));

            //We have to set the command here to ensure that the selection changed event is triggered earlier
            EditCommand = new MvxCommand<Payment>(Edit);
        }
 public MenuItem(string title, MainMenuViewModel parent, Type viewModelType)
 {
     Title = title;
     ViewModelType = viewModelType;
     ShowCommand = new MvxCommand(() => parent.ShowViewModel(ViewModelType));
 }
 public Tab1ViewModel()
 {
     OpenChildCommand = new MvxCommand(() => ShowViewModel<TabChildViewModel>());
     OpenModalCommand = new MvxCommand(() => ShowViewModel<ModalViewModel>());
 }
 public FirstViewModel()
 {
     //SetTime= new MvxCommand(()=>{SetTimeString();});
     SetTime = new MvxCommand(() => { GotoList(); });
 }