private void Login_cmd()
        {

            //int res = ViewModelLocator.Instance.DataBase.Database.SqlQuery<int>("select count(1) from AppSettings").First();
            if (!EFDbContext.DataBase.AppSetting.Any())
            {
                // First start
                //InitialPopulating.PopulateDB();
                Guid guid;
                SQL_XML_Operations.Load(FileService.GetMainDataDirectory() + "Resources\\InitialData.xml",out guid);

                AppSetting apset = new AppSetting();
                apset.Init();
                apset.Name = "Main";
                ViewModelLocator.Instance.DataBase.AppSetting.Add(apset);
                EFDbContext.SaveChgs();
                ViewModelLocator.Instance.AppSetting = apset;

                NavigationService.OpenDialog(Form.InitialWizard,new InitialWizard_parameters { AppSetting = apset});
            }
            else {
                var res2 = ViewModelLocator.Instance.DataBase.Database.SqlQuery<Guid>("select id from AppSettings where Name=@Name",SQLParam.New("Name","Main")).ToList();
                ViewModelLocator.Instance.AppSetting = ViewModelLocator.Instance.DataBase.AppSetting.Find(res2[0]);
            }

            NavigationService.NavigateForward(Form.MainWindow);
        }
        public WordsTranslation_ViewModel(INavigationService NavigationService_,IDialogService DialogService_,AppSetting AppSetting_)
        {
            if (IsInDesignMode)
            {
                mode = Mode.Edit;
            }

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSetting = AppSetting_;

                Statuses = WordOfDictionary.WordStatuses.Statuses;
            }

            ExecuteCommand = new RelayCommand<string>(CommandDispatcher);
            PressWordButton_Command = new RelayCommand<ButtonModel>(PressWordButton_Cmd);

            WordsForSelection_Buttons = new ObservableCollection<ButtonModel>(); 

            btnNextButton = new ButtonModel();
            btnPreviousButton = new ButtonModel();
            btnAddToDictionary = new ButtonModel();
            btnSkip = new ButtonModel();
            WordsCollection_ListModel = new List_Model();
            btnTrainingNext = new ButtonModel();
            btnOk = new ButtonModel();

            if (IsInDesignMode)
            {
                CurrentWord = new WordOfDictionary();
                CurrentWord.word = "White";
                CurrentWord.translation_as_string = "Белый";
                CurrentWord.transcription = "[wʌɪt]";
                //CurrentWord.commentary = "{Белый цвет, не черный, не зеленый, а именно белый. \nСовершенно белый.\nНу может с желтоватым отливом}";
                CurrentWord.pictures_url = "http://d144fqpiyasmrr.cloudfront.net/uploads/picture/295623.png";

                CurrentWord.translations.Add(new TranslationOfWord() {translation="белый",votes=150 });
                CurrentWord.translations.Add(new TranslationOfWord() {translation="беловатый",votes=50 });
                CurrentWord.translations.Add(new TranslationOfWord() {translation="беленький, беловатый, бледноватный, беловатенькая, серобуромалиновенькая, ярко белая в крапинку",votes=15 });

                WordsForSelection_Buttons.Add(new ButtonModel() { Text="Зелёный"});
                WordsForSelection_Buttons.Add(new ButtonModel() { Text="Белый"});
                WordsForSelection_Buttons.Add(new ButtonModel() { Text="Черный"});
                WordsForSelection_Buttons.Add(new ButtonModel() { Text="Пурпурный"});
                WordsForSelection_Buttons.Add(new ButtonModel() { Text="Фиолетовый"});

                WordsCollection = new ObservableCollection<WordOfDictionary>();
                WordsCollection.Add(new WordOfDictionary() {word = "everybody"});
                WordsCollection.Add(new WordOfDictionary() {word = "likes"});
                WordsCollection.Add(new WordOfDictionary() {word = "cakes"});

                Header_LabelModel.Text = "This is a Header";

                SetCurrentWord(CurrentWord);
            }

        }
        public PlayerWindowViewModel(IPlayer IPlayer_,ILogger Logger_,INavigationService NavigationService_,IDialogService DialogService_,AppSetting AppSetting_) : base()
        {
            player = IPlayer_;
            Logger = Logger_;
            NavigationService = NavigationService_;
            DialogService = DialogService_;
            AppSetting = AppSetting_;

            Messenger.Default.Register<PlayerEvent>(this, Controller);
            //Messenger.Default.Register<AppEvent>(this, OnAppEvent);

            CollectPhrases_Buttons = new ObservableCollection<ButtonModel>();

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

            PressCollectWordsButton_Command = new RelayCommand<ButtonModel>(PressCollectWordsButton_Cmd);
            TranslateWord_Command = new RelayCommand<PhraseOfCollectMode.Word>(TranslateWord_Cmd);

            VideoFrameVisibility = Visibility.Visible;
        }