Esempio n. 1
0
 private void FileClickCommandExecute(ItemClickEventArgs e)
 {
     //유료 버전기능 체크
     if (VersionHelper.CheckPaidFeature())
     {
         var playList = new MediaInfo[] { e.ClickedItem as MediaInfo };
         MessengerInstance.Send <Message>(new Message("PlayList", playList), PlaylistViewModel.NAME);
         //검색 패털 닫기
         IsSearchOpened = false;
     }
 }
Esempio n. 2
0
        private async void CheckPaidFeature(Action action)
        {
            if (!isChecking)
            {
                isChecking = true;
                await System.Threading.Tasks.Task.Delay(100);

                if (!VersionHelper.CheckPaidFeature())
                {
                    action.Invoke();
                }
                isChecking = false;
            }
        }
Esempio n. 3
0
        private async void SavePlayListTappedCommandExecute(TextBox value)
        {
            if (VersionHelper.CheckPaidFeature())
            {
                var pl = new PlayList
                {
                    Name = value.Text.Trim(),
                    Seq  = CurrentPlayList.Seq,
                };

                var resource = ResourceLoader.GetForCurrentView();
                if (string.IsNullOrEmpty(pl.Name) || CurrentPlayList.Name == pl.Name)
                {
                    value.Focus(FocusState.Keyboard);
                }
                else if (playListDAO.GetPlayList(pl.Name) != null)
                {
                    UpdatePlayList.ShowErrorMessage = true;
                    UpdatePlayList.ErrorMessage     = resource.GetString("Message/Error/DuplicatedName");
                    value.SelectAll();
                    value.Focus(FocusState.Keyboard);
                }
                else
                {
                    UpdatePlayList.ShowErrorMessage = false;
                    UpdatePlayList.ErrorMessage     = string.Empty;

                    var result = playListDAO.UpdatePlayList(pl);
                    if (result == SQLitePCL.SQLiteResult.DONE)
                    {
                        CurrentPlayList.Name = pl.Name;
                        RaisePropertyChanged("CurrentPlayList");
                        MessengerInstance.Send(new KeyValuePair <string, PlayList>("updated", pl), "PlayListChanged");
                        DialogHelper.HideFlyout(App.Current.Resources, "PlayListFlyout");
                    }
                    else
                    {
                        DialogHelper.HideFlyout(App.Current.Resources, "PlayListFlyout");
                        var dlg = DialogHelper.GetSimpleContentDialog(
                            resource.GetString("Message/Error/Save"),
                            resource.GetString("Message/Error/Retry"),
                            resource.GetString("Button/Close/Content"));
                        await dlg.ShowAsync();

                        App.ContentDlgOp = null;
                    }
                }
            }
        }
 private void ToggledCommandExecute(string value)
 {
     switch (value)
     {
     case "FlipToPause":
         if (VersionHelper.CheckPaidFeature())
         {
             Settings.Playback.UseFlipToPause = _UseFlipToPause;
         }
         else
         {
             Settings.Playback.UseFlipToPause = false;
             Set(ref _UseFlipToPause, false);
             RaisePropertyChanged("UseFlipToPause");
         }
         break;
     }
 }
Esempio n. 5
0
        public void UseAppLockSwitchToggled(object sender, RoutedEventArgs e)
        {
            var tw = e.OriginalSource as ToggleSwitch;

            if (tw.IsOn)
            {
                if (VersionHelper.CheckPaidFeature())
                {
                    Settings.Privacy.UseAppLock = true;
                }
                else
                {
                    tw.IsOn = false;
                }
            }
            else
            {
                Settings.Privacy.UseAppLock = false;
            }
        }
Esempio n. 6
0
        public async void SavePasswordTapped(object sender, TappedRoutedEventArgs e)
        {
            var resource = ResourceLoader.GetForCurrentView();
            var password = Password.Replace(" ", "");

            if (string.IsNullOrWhiteSpace(password) || password.Length < 4)
            {
                var dlg = DialogHelper.GetSimpleContentDialog(
                    resource.GetString("AppLock/Password/Validate1/Title"),
                    resource.GetString("AppLock/Password/Validate/Text"),
                    resource.GetString("ConentDialog/Button/Save"));

                await dlg.ShowAsync();

                App.ContentDlgOp = null;
                Password         = password;
            }
            else
            {
                if (password.Length != Password.Length)
                {
                    var dlg = DialogHelper.GetSimpleContentDialog(
                        resource.GetString("AppLock/Password/Validate2/Title"),
                        resource.GetString("AppLock/Password/Validate/Text"),
                        resource.GetString("Button/Ok/Content"));

                    await dlg.ShowAsync();

                    App.ContentDlgOp = null;
                    Password         = password;
                }
                else
                {
                    ContentDialog dlg = null;

                    if (!Settings.Privacy.UseAppLock)
                    {
                        dlg = DialogHelper.GetSimpleContentDialog(
                            resource.GetString("AppLock/Password/Validate3/Title"),
                            resource.GetString("AppLock/Password/Validate3/Text"),
                            resource.GetString("Button/AppLock/TurnOff"),
                            resource.GetString("Button/AppLock/TurnOn"));

                        ContentDialogResult result = await dlg.ShowAsync();

                        App.ContentDlgOp = null;

                        if (result == ContentDialogResult.Secondary && VersionHelper.CheckPaidFeature())
                        {
                            Settings.Privacy.UseAppLock = true;
                        }
                    }
                    else
                    {
                        dlg = DialogHelper.GetSimpleContentDialog(
                            resource.GetString("AppLock/Password/Validate3/Title"),
                            resource.GetString("AppLock/Login/Title/Text"),
                            resource.GetString("Button/Ok/Content"));

                        await dlg.ShowAsync();

                        App.ContentDlgOp = null;
                    }
                }
                Settings.Privacy.AppLockPassword = Password;

                //DB에 저장
                settingDAO.Replace(Settings);
                EnabledSaveButton = false;
            }
        }
Esempio n. 7
0
        public async void ChangeFileExtensionTapped(object sender, TappedRoutedEventArgs e)
        {
            if (VersionHelper.CheckPaidFeature())
            {
                string newExtension = ".4CCP";
                var    resource     = ResourceLoader.GetForCurrentView();
                var    picker       = new FileOpenPicker()
                {
                    SuggestedStartLocation = PickerLocationId.VideosLibrary,
                    ViewMode         = PickerViewMode.List,
                    CommitButtonText = resource.GetString("FileAssociation/Change/Commit/Content")
                };

                foreach (var suffix in CCPlayer.UWP.Xaml.Controls.MediaFileSuffixes.VIDEO_SUFFIX.Where(x => x.ToUpper() != newExtension))
                {
                    picker.FileTypeFilter.Add(suffix);
                }

                //picker.PickSingleFileAndContinue();
                IReadOnlyList <StorageFile> fileList = await picker.PickMultipleFilesAsync();

                if (fileList != null && fileList.Count > 0)
                {
                    string orgName  = string.Empty;
                    string fileName = string.Empty;
                    int    count    = 0;
                    foreach (var file in fileList)
                    {
                        try
                        {
                            orgName = file.Name;
                            await file.RenameAsync(Path.GetFileNameWithoutExtension(orgName) + newExtension, NameCollisionOption.FailIfExists);

                            if (string.IsNullOrEmpty(fileName))
                            {
                                fileName = orgName;
                            }
                            else
                            {
                                count++;
                            }
                        }
                        catch (Exception ex)
                        {
                            System.Diagnostics.Debug.WriteLine(file.Name + "은 이미 존재하는 파일입니다. =>" + ex.Message);
                        }
                    }

                    string title   = string.Empty;
                    string content = string.Empty;

                    if (count > 0)
                    {
                        title   = resource.GetString("FileAssociation/Change/Success/Title");
                        content = string.Format(resource.GetString("FileAssociation/Change/Success1/Content"), fileName, count, newExtension);
                    }
                    else if (!string.IsNullOrEmpty(fileName))
                    {
                        title   = resource.GetString("FileAssociation/Change/Success/Title");
                        content = string.Format(resource.GetString("FileAssociation/Change/Success2/Content"), fileName, newExtension);
                    }
                    else
                    {
                        title   = resource.GetString("FileAssociation/Change/Fail/Title");
                        content = string.Format(resource.GetString("FileAssociation/Change/Fail/Content"), newExtension);
                    }

                    var dlg = DialogHelper.GetSimpleContentDialog(title, content, resource.GetString("Button/Ok/Content"));
                    await dlg.ShowAsync();

                    App.ContentDlgOp = null;
                }
            }
        }
Esempio n. 8
0
        private void LockFolderCommandExecute(FolderInfo folderInfo)
        {
            if (!VersionHelper.CheckPaidFeature())
            {
                return;
            }

            bool   isLocking = false;
            string title     = string.Empty;

            if (string.IsNullOrEmpty(folderInfo.Passcode))
            {
                isLocking = false;
                title     = ResourceLoader.GetForCurrentView().GetString("Message/Confirm/Create/Password");
            }
            else
            {
                isLocking = true;
                title     = ResourceLoader.GetForCurrentView().GetString("Message/Confirm/Remove/Password");
            }

            StackPanel contentPanel = new StackPanel();

            contentPanel.Children.Add(new TextBlock
            {
                Text         = title,
                TextWrapping = TextWrapping.Wrap,
                Margin       = new Thickness(0, 12, 0, 12)
            });

            PasswordBox pbox = new PasswordBox
            {
                MaxLength = 8,
                Margin    = new Thickness(0, 12, 0, 12)
            };

            contentPanel.Children.Add(pbox);

            ContentDialog contentDlg = new ContentDialog
            {
                Content = contentPanel,
                IsPrimaryButtonEnabled = false,
                PrimaryButtonText      = ResourceLoader.GetForCurrentView().GetString("Ok"),
                SecondaryButtonText    = ResourceLoader.GetForCurrentView().GetString("Cancel")
            };

            pbox.PasswordChanged += (sender, args) =>
            {
                if (isLocking)
                {
                    contentDlg.IsPrimaryButtonEnabled = folderInfo.Passcode == pbox.Password;
                }
                else
                {
                    contentDlg.IsPrimaryButtonEnabled = !string.IsNullOrEmpty(pbox.Password);
                }
            };

            //메세지 창 출력
            App.ContentDlgOp = contentDlg.ShowAsync();

            //후처리기 등록
            App.ContentDlgOp.Completed = new AsyncOperationCompletedHandler <ContentDialogResult>(async(op, status) =>
            {
                var result = await op;
                if (result == ContentDialogResult.Primary)
                {
                    if (isLocking)
                    {
                        if (folderInfo.Passcode == pbox.Password)
                        {
                            //잠금 해제
                            folderInfo.Passcode = string.Empty;
                            folderDAO.Update(folderInfo);

                            //전체 비디오에서 추가 요청
                            MessengerInstance.Send <Message>(new Message("FolderAdded", folderInfo), AllVideoViewModel.NAME);
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(pbox.Password))
                        {
                            //잠금 설정
                            folderInfo.Passcode = pbox.Password;
                            folderDAO.Update(folderInfo);

                            //전체 비디오에서 삭제 요청
                            MessengerInstance.Send <Message>(new Message("FolderDeleted", folderInfo), AllVideoViewModel.NAME);
                            //재생 목록에서 삭제 요청
                            MessengerInstance.Send <Message>(new Message("FolderDeleted", folderInfo), PlaylistViewModel.NAME);
                        }
                    }
                }
                App.ContentDlgOp = null;
            });
        }