Пример #1
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;
            }
        }
Пример #2
0
        protected override void RegisterEventHandler()
        {
            //폰트 변경시 재로드
            FontHelper.FontFamilyListChanged += (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) =>
            {
                if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                {
                    foreach (KeyName item in e.NewItems)
                    {
                        if (!FontSource.Contains(item))
                        {
                            FontSource.Add(item);
                        }
                    }
                }
                else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
                {
                    foreach (KeyName item in e.OldItems)
                    {
                        if (!FontSource.Contains(item))
                        {
                            FontSource.Remove(item);
                        }
                    }

                    if (e.OldItems.Cast <KeyName>().Any(x => x.Key.ToString() == Settings.ClosedCaption.CCFontFamily))
                    {
                        Settings.ClosedCaption.CCFontFamily = FontHelper.FONT_FAMILY_DEFAUT;
                        //폰트가 삭제되어 선택이 사라지는 현상을 제거하기 위해 저장
                        _SettingDAO.Replace(Settings);
                    }
                }

                Settings.ClosedCaption.OnPropertyChanged("CCFontFamily");
            };

            SampleImageSizeChangedEventHandler = (sender, args) =>
            {
                if (args.NewSize.Width != 0 && args.NewSize.Height != 0)
                {
                    SampleImageSize = args.NewSize;
                }
            };

            SampleImageOpenedEventHandler = (sender, args) =>
            {
                if (SampleSubtitleData == null)
                {
                    var resource = ResourceLoader.GetForCurrentView();

                    JsonObject obj = new JsonObject()
                    {
                        ["Pts"] = JsonValue.CreateNumberValue(0),
                        ["StartDisplayTime"] = JsonValue.CreateNumberValue(0),
                        ["EndDisplayTime"]   = JsonValue.CreateNumberValue(0),
                        ["Format"]           = JsonValue.CreateNumberValue(1),
                        ["NumRects"]         = JsonValue.CreateNumberValue(1),
                        ["Rects"]            = new JsonArray()
                        {
                            new JsonObject()
                            {
                                ["Guid"]  = JsonValue.CreateStringValue(""),
                                ["Type"]  = JsonValue.CreateNumberValue(3),
                                ["Text"]  = JsonValue.CreateStringValue(""),
                                ["Ass"]   = JsonValue.CreateStringValue(resource.GetString("Sample/Subtitle/Text")),
                                ["Style"] = new JsonObject()
                                {
                                    ["Name"]             = JsonValue.CreateStringValue(""),
                                    ["FontSize"]         = JsonValue.CreateStringValue(resource.GetString("Sample/Subtitle/BaseFontSize")),
                                    ["BorderStyle"]      = JsonValue.CreateStringValue("1"),
                                    ["OutlineThickness"] = JsonValue.CreateNumberValue(1),
                                    ["ShadowThickness"]  = JsonValue.CreateNumberValue(1.5),
                                    ["MarginLeft"]       = JsonValue.CreateStringValue("6"),
                                    ["MarginRight"]      = JsonValue.CreateStringValue("6"),
                                    ["MarginBottom"]     = JsonValue.CreateStringValue("24")
                                }
                            }
                        }
                    };

                    SampleSubtitleData = obj;
                }

                var img        = sender as Image;
                var storyboard = img.Resources["FadeInStoryboard"] as Storyboard;
                storyboard.Begin();
            };

            ImageRefreshTappedEventHandler = (sender, args) =>
            {
                if (!_SampleImageUriEnumerator.MoveNext())
                {
                    _SampleImageUriEnumerator.Reset();
                    _SampleImageUriEnumerator.MoveNext();
                }

                SampleImageSource = new BitmapImage(_SampleImageUriEnumerator.Current as Uri);
            };

            FontFamilyComboBoxLoadedEventHandler = (sender, args) =>
            {
                _FontFamilyComboBox = sender as ComboBox;
                //폰트 로드
                if (FontSource.Count == 0)
                {
                    LoadFontList();
                }
            };
        }