Пример #1
0
        /// <summary>
        /// Метод получающий подтверждение на удаление.
        /// </summary>
        /// <returns> Результат запроса true или false. </returns>
        private bool GetConfirmationForDeletion()
        {
            var confirmationForDeletionViewModel = new ConfirmationForDeletionViewModel();

            DisplayRootRegistry.ShowModalPresentation(confirmationForDeletionViewModel);

            return(confirmationForDeletionViewModel.Result);
        }
Пример #2
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            mainViewModel = new MainViewModel();

            await displayRootRegistry.ShowModalPresentation(mainViewModel);

            Shutdown();
        }
Пример #3
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var MainWindowVM = new AddVisitorVM();

            await displayRootRegistry.ShowModalPresentation(MainWindowVM);

            Shutdown();
        }
Пример #4
0
        /// <summary>
        /// Метод меняющий название текущему плейлисту.
        /// </summary>
        public void RenamePlaylistMethod(object param)
        {
            RenamePlaylistViewModel renamePlaylistViewModel = new RenamePlaylistViewModel();

            DisplayRootRegistry.ShowModalPresentation(renamePlaylistViewModel);

            if (renamePlaylistViewModel.NewTitle != null && renamePlaylistViewModel.NewTitle != "")
            {
                if (!audioControl.IsPlaylistExist(renamePlaylistViewModel.NewTitle))
                {
                    audioControl.RenameCurrentPlaylist(renamePlaylistViewModel.NewTitle);

                    Update();
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Метод добавляющий плейлист.
        /// </summary>
        public void AddPlaylistMethod(object param)
        {
            var newPlaylistViewModel = new PlaylistControlViewModel();

            DisplayRootRegistry.ShowModalPresentation(newPlaylistViewModel);

            if (newPlaylistViewModel.NewPlaylist.Count != 0 && newPlaylistViewModel.Result == true)
            {
                var newPlaylist = new List <Audio>();

                TitleNewPlaylist = newPlaylistViewModel.TitleNewPlaylist;

                if (TitleNewPlaylist == null || TitleNewPlaylist == "")
                {
                    TitleNewPlaylist = "New Title";
                }
                while (audioControl.IsPlaylistExist(TitleNewPlaylist))
                {
                    TitleNewPlaylist += 1;
                }
                foreach (var item in newPlaylistViewModel.NewPlaylist)
                {
                    if (!audioControl.IsSongExist(item.SourceUrl))
                    {
                        newPlaylist.Add(item);
                    }
                }
                if (newPlaylist.Count != 0)
                {
                    // Сохраняет песню в базу данных.
                    dataBaseControl.SaveFileToDatabase(newPlaylist, TitleNewPlaylist);

                    audioControl.SetNewPlayList(TitleNewPlaylist, newPlaylist);

                    Update();
                }
            }
        }
Пример #6
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            var proc        = new ProcessHelper();
            var settingHelp = new SettingHelper();

            if (proc.CheckProcessByName(CommonConstant.NameAppUpdater))
            {
                proc.CloseProcess(CommonConstant.NameAppUpdater);
            }

            var getArgs = Environment.GetCommandLineArgs();

            try
            {
                if (getArgs.Length == 2)
                {
                    settingHelp.RemoveProgram(CommonConstant.PathUpdater, true);
                    settingHelp.CopyFilesProgram(Path.GetTempPath() + getArgs[1] + "\\" + CommonConstant.PathUpdater, CommonConstant.PathUpdater, true);
                    settingHelp.RemoveProgram(Path.GetTempPath() + getArgs[1], true);
                }
            }
            catch (Exception)
            {
            }


            if (!File.Exists(CommonConstant.PathUpdater + CommonConstant.StartAppUpdater))
            {
                MessageBox.Show(Constant.NotFoundUpdater);
                Shutdown();
                return;
            }

            if (!File.Exists(CommonConstant.FileSettingsLauncher))
            {
                MessageBox.Show(Constant.DescriptionMessBoxNotFoundSettings);
                Shutdown();
                return;
            }

            var token = proc.GetPublicKeyTokenFromAssembly(Assembly.GetCallingAssembly());

            if (string.IsNullOrEmpty(token))
            {
                MessageBox.Show(Constant.CrashLauncher);
                Shutdown();
                return;
            }

            var mut = new Mutex(true, token, out instance);

            if (!instance)
            {
                MessageBox.Show(Constant.AlreadyStartLauncher);
                Shutdown();
                return;
            }

            var args = new string[1]
            {
                Process.GetCurrentProcess().Id.ToString()
            };

            var setHelp = new SettingHelper();
            var set     = setHelp.Read <LauncherSettingSerializer>(CommonConstant.KeySettings, CommonConstant.FileSettingsLauncher);


            Constant.PidUpdater = proc.StartProcess(CommonConstant.PathUpdater + CommonConstant.StartAppUpdater, args);

            base.OnStartup(e);

            _mainWindowViewModel = new CollectionsDataViewModel();

            await DisplayRootRegistry.ShowModalPresentation(_mainWindowViewModel);

            Shutdown();
        }