Example #1
0
        private void MemberStatusChanged()
        {
            StringResources stx = new StringResources();
            LoginOrInfo = Member.IsLoggedIn
                ? stx.Text( "Login_AccountName" )
                : stx.Text( "Login" )
                ;

            RefreshAvatar();

            if( !Member.IsLoggedIn )
            {
                if ( Member.WillLogin ) return;

                Image.Destroy( Avatar );
                NotifyChanged( "Avatar" );
                return;
            }

            X.Instance<IRuntimeCache>( XProto.WRuntimeCache, 0, false )
                .InitDownload(
                "USER_AVATAR"
                , X.Call<XKey[]>( XProto.WRequest, "GetUserAvatar" )
                , AvatarLoaded
                , ( string id, string url, Exception ex ) => { RefreshAvatar(); }
                , false
            );
        }
Example #2
0
        public Register()
        {
            this.InitializeComponent();

            StringResources stx = new StringResources( "AppResources", "ContextMenu" );
            PrimaryButtonText = stx.Text( "Register", "ContextMenu" );
            SecondaryButtonText = stx.Text( "Button_Back");
        }
Example #3
0
        private Rename()
        {
            this.InitializeComponent();
            StringResources stx = new StringResources( "Message", "ContextMenu" );
            PrimaryButtonText = stx.Str( "OK" );
            SecondaryButtonText = stx.Str( "Cancel" );

            TitleBlock.Text = stx.Text( "Rename", "ContextMenu" );
        }
Example #4
0
        public ReviewsInput( Review R )
            :this()
        {
            IsReview = true;

            StringResources stx = new StringResources( "AppBar" );
            Title.Text = stx.Text( "Reply" );
            TitleSection.Visibility = Visibility.Collapsed;
        }
Example #5
0
        public Login( IMember Member )
        {
            this.InitializeComponent();
            this.Member = Member;

            StringResources stx = new StringResources();
            PrimaryButtonText = stx.Text( "Login" );
            SecondaryButtonText = stx.Text( "Button_Back" );

            if ( Member.Status == MemberStatus.RE_LOGIN_NEEDED )
            {
                ShowMessage( stx.Text( "Login_Expired" ) );
            }

            Member.OnStatusChanged += Member_StatusUpdate;

            if( Member.CanRegister )
            {
                RegisterBtn.Visibility = Visibility.Visible;
            }
        }
Example #6
0
        private ReviewsInput()
        {
            this.InitializeComponent();
            STopicType.SelectedIndex = 0;

            if( global::wenku8.Config.Properties.REVIEWS_SIGN == null )
            {
                StringResources stx = new StringResources( "Settings" );
                global::wenku8.Config.Properties.REVIEWS_SIGN
                    = stx.Text( "Account_Reviews_Post_Sign_Default" );
            }

            Sign.Text = global::wenku8.Config.Properties.REVIEWS_SIGN;
        }
Example #7
0
        private void SetTemplate()
        {
            StringResources stx = new StringResources( "Message" );

            PrimaryButtonText = stx.Str( "OK" );
            SecondaryButtonText = stx.Str( "Cancel" );

            stx = new StringResources( "AppBar" );
            Title = stx.Text( "Bookmark" );

            stx = new StringResources( "AppResources" );
            BookmarkName.PlaceholderText = stx.Text( "DefaultToParagraph" );

            ColorGrid.ItemsSource = PresetColors;
        }
Example #8
0
        public void LoadUrl( LocalModeTxtList.DownloadBookContext Context )
        {
            RuntimeCache rCache = new RuntimeCache();
            Logger.Log( ID, Context.Id, LogType.DEBUG );
            Logger.Log( ID, Context.Title, LogType.DEBUG );

            Worker.UIInvoke( () =>
            {
                StringResources stx = new StringResources( "AdvDM" );
                Loading = stx.Text( "Active" );
            } );

            rCache.GET( Context.Url, ( e, url ) =>
            {
                Loading = null;
                SaveTemp( e, Context );
            }
            , ( id, url, ex ) =>
            {
                Logger.Log( ID, "Cannot download: " + id, LogType.WARNING );
                Logger.Log( ID, ex.Message, LogType.WARNING );

            }, false );
        }
Example #9
0
        private void NewComment( string Label )
        {
            TransitionDisplay.SetState( CommentEditor, TransitionState.Active );
            CommentModeLabel.Text = Label;

            if( BindItem.ForceEncryption && Crypt == null )
            {
                CommentInput.IsEnabled = false;
                StringResources stx = new StringResources();
                CommentError.Text = stx.Text( "CommentsEncrypted" );
                DisplayControls( "Discard" );
            }
            else
            {
                CommentInput.IsEnabled = true;
                DisplayControls( "Submit", "Discard" );
                CommentError.Text = "";
            }
        }
Example #10
0
        public async void PlaceRequest( SHTarget Target, HubScriptItem HSI )
        {
            StringResources stx = new StringResources();

            PlaceRequest RequestBox = new PlaceRequest(
                Target, HSI
                , stx.Text( ( Target & SHTarget.KEY ) != 0 ? "KeyRequest" : "TokenRequest" )
            );

            await Popups.ShowDialog( RequestBox );
            if ( !RequestBox.Canceled ) OpenRequest( Target );
        }
Example #11
0
        private void NewReply( object sender, RoutedEventArgs e )
        {
            HSComment HSC = ( HSComment ) ( ( FrameworkElement ) sender ).DataContext;
            StringResources stx = new StringResources( "AppBar" );

            CCTarget = SHTarget.COMMENT;
            CCId = HSC.Id;
            NewComment( stx.Text( "Reply" ) );
        }
Example #12
0
        private void InitTemplate()
        {
            ReaderContext = new ReaderView();
            ContentGrid.DataContext = ReaderContext;
            ContextGrid.DataContext = new ESContext();

            RBgContext = ReaderContext.Settings.GetBgContext();
            ContentBg.DataContext = RBgContext;

            RBgContext.ApplyBackgrounds();

            StringResources stx = new StringResources( "Settings" );

            ExpContent = new Paragraph[]
            {
                new Paragraph( stx.Text( "Appearance_ContentReader_Exp1") )
                , new Paragraph( stx.Text( "Appearance_ContentReader_Exp2") )
                , new Paragraph( stx.Text( "Appearance_ContentReader_Exp3") )
                , new Paragraph( stx.Text( "Appearance_ContentReader_Exp4") )
            };

            XTitleStepper.Text = YTitleStepper.Text = stx.Text( "Appearance_ContentReader_Exp2" );

            ColorList.ItemsSource = new ColorItem[]
            {
                new ColorItem(
                    stx.Text( "Appearance_ContentReader_Background" )
                    , Properties.APPEARANCE_CONTENTREADER_BACKGROUND
                )
                {
                    BindAction = ( c ) => {
                        Properties.APPEARANCE_CONTENTREADER_BACKGROUND = c;
                        UpdateExampleFc();
                    }
                }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_FontColor" )
                    , Properties.APPEARANCE_CONTENTREADER_FONTCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_FONTCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_TapBrushColor" )
                    , Properties.APPEARANCE_CONTENTREADER_TAPBRUSHCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_TAPBRUSHCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_NavBg" )
                    , Properties.APPEARANCE_CONTENTREADER_NAVBG
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_NAVBG = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_AssistHelper" )
                    , Properties.APPEARANCE_CONTENTREADER_ASSISTBG
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_ASSISTBG = c; } }
            };

            ClockColorList.ItemsSource = new ColorItem[]
            {
                new ColorItem(
                    stx.Text( "Appearance_ContentReader_Clock_ARColor" )
                    , Properties.APPEARANCE_CONTENTREADER_CLOCK_ARCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_CLOCK_ARCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_Clock_HHColor" )
                    , Properties.APPEARANCE_CONTENTREADER_CLOCK_HHCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_CLOCK_HHCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_Clock_MHColor" )
                    , Properties.APPEARANCE_CONTENTREADER_CLOCK_MHCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_CLOCK_MHCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_Clock_SColor" )
                    , Properties.APPEARANCE_CONTENTREADER_CLOCK_SCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_CLOCK_SCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_EStepper_DColor" )
                    , Properties.APPEARANCE_CONTENTREADER_ES_DCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_ES_DCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_EStepper_SColor" )
                    , Properties.APPEARANCE_CONTENTREADER_ES_SCOLOR
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_ES_SCOLOR = c; } }

                , new ColorItem(
                    stx.Text( "Appearance_ContentReader_Background" )
                    , Properties.APPEARANCE_CONTENTREADER_ES_BG
                ) { BindAction = ( c ) => { Properties.APPEARANCE_CONTENTREADER_ES_BG = c; } }
            };

            BatteryReport Report = Battery.AggregateBattery.GetReport();
            if ( Report.RemainingCapacityInMilliwattHours != null )
            {
                YClock.Progress
                    = XClock.Progress
                    = ( float ) Report.RemainingCapacityInMilliwattHours / ( float ) Report.FullChargeCapacityInMilliwattHours;
            }

            FontSizeSlider.Value = Properties.APPEARANCE_CONTENTREADER_FONTSIZE;
            LineSpacingSlider.Value = Properties.APPEARANCE_CONTENTREADER_LINEHEIGHT;
            ParagraphSpacingSlider.Value = 2 * Properties.APPEARANCE_CONTENTREADER_PARAGRAPHSPACING;

            FontWeight FWeight = Properties.APPEARANCE_CONTENTREADER_FONTWEIGHT;
            // Set font weights
            Dictionary<string, FontWeight> ForReflection = new Dictionary<string, FontWeight>()
            {
                { "Thin", FontWeights.Thin }
                , { "ExtraLight", FontWeights.ExtraLight }
                , { "Light", FontWeights.Light }
                , { "SemiLight", FontWeights.SemiLight }
                , { "Normal", FontWeights.Normal }
                , { "Medium", FontWeights.Medium }
                , { "SemiBold", FontWeights.SemiBold }
                , { "Bold", FontWeights.Bold }
                , { "ExtraBold", FontWeights.ExtraBold }
                , { "Black", FontWeights.Black }
                , { "ExtraBlack", FontWeights.ExtraBlack }
            };

            Logger.Log( ID, "Default FontWeight is " + FWeight.Weight );
            List<PInfoWrapper> PIW = new List<PInfoWrapper>();
            foreach ( KeyValuePair<string, FontWeight> K in ForReflection )
            {
                PInfoWrapper PWrapper = new PInfoWrapper( K.Key, K.Value );
                PIW.Add( PWrapper );
            }
            FontWeightCB.ItemsSource = PIW;

            FontWeightCB.SelectedItem = PIW.First( x => x.Weight.Weight == FWeight.Weight );

            YClock.Time = XClock.Time = DateTime.Now;
            XDayofWeek.Text = YDayofWeek.Text = YClock.Time.ToString( "dddd" );
            XDayofMonth.Text = YDayofMonth.Text = YClock.Time.Day.ToString();
            XMonth.Text = YMonth.Text = YClock.Time.ToString( "MMMM" );

            SetLayoutAware();

            UpdateExampleLs();
            UpdateExamplePs();
            UpdateExampleFc();
            UpdateExampleFs();
            for ( int i = 0; i < 3; i++ )
            {
                var j = ContentGrid.Dispatcher.RunIdleAsync( ( x ) => UpdateExampleFs() );
            }
        }
Example #13
0
        private async void Toggled_PageClick( object sender, RoutedEventArgs e )
        {
            if ( !TemplateSet ) return;

            if( TogPageClick.IsOn && Properties.APPEARANCE_CONTENTREADER_ENABLEREADINGANCHOR )
            {
                StringResources stx = new StringResources( "Settings" );
                MessageDialog Msg = new MessageDialog( stx.Text( "Layout_ContentReader_UsePageClick_Warning" ), stx.Text( "Layout_ContentReader_UsePageClick" ) );

                Msg.Commands.Add(
                    new UICommand( stx.Text( "Enabled" ) )
                );

                Msg.Commands.Add(
                    new UICommand( stx.Text( "Disabled" ), ( x ) => TogPageClick.IsOn = false )
                );
                await Popups.ShowDialog( Msg );
            }

            Properties.APPEARANCE_CONTENTREADER_ENABLEREADINGANCHOR = !TogPageClick.IsOn;

            if( TogPageClick.IsOn )
            {
                Properties.APPEARANCE_CONTENTREADER_ENABLEDOUBLETAP = TogDoubleTap.IsOn = false;
            }
        }
Example #14
0
        public async Task<bool> ConfirmRestart( string CaptionRes )
        {
            StringResources stx = new StringResources( "Settings" );
            StringResources stm = new StringResources( "Message" );

            // Ask for confirmatiosn
            MessageDialog Confirm = new MessageDialog( stm.Str( "NeedRestart" ), stx.Text( CaptionRes ) );

            bool Restart = false;

            Confirm.Commands.Add(
                new UICommand(
                    stm.Str( "Yes" )
                    , ( e ) => { Restart = true; }
                )
            );

            Confirm.Commands.Add(
                new UICommand( stm.Str( "No" ) )
            );

            await Popups.ShowDialog( Confirm );

            if( Restart )
            {
                Frame.BackStack.Clear();
                NavigationHandler.InsertHandlerOnNavigatedBack( Exit );
                RestartMask.State = ControlState.Reovia;
                PopupPage.State = ControlState.Foreatii;
            }

            return Restart;
        }
Example #15
0
        public void DefineSettings()
        {
            StringResources stx = new StringResources( "Settings" );

            string CurrentLang = Properties.LANGUAGE;
            SettingsSection LangSection = new SettingsSection()
            {
                Title = stx.Text( "Language" )
                , Data = new ActiveItem[]
                {
                    new ActionItem(
                        stx.Text( "Language_E")
                        , CurrentLang == "en-US"
                            ? stx.Text( "Desc_Language_C" )
                            : stx.Text( "Desc_Language_AE" )
                        , "en-US"
                    )
                    , new ActionItem(
                        stx.Text( "Language_T")
                        , CurrentLang == "zh-TW"
                            ? stx.Text( "Desc_Language_C" )
                            : stx.Text( "Desc_Language_AT" )
                        , "zh-TW"
                    )
                    , new ActionItem(
                        stx.Text( "Language_S")
                        , CurrentLang == "zh-CN"
                            ? stx.Text( "Desc_Language_C" )
                            : stx.Text( "Desc_Language_AS" )
                        , "zh-CN"
                    )
                    , new ActionItem(
                        stx.Text( "Language_J")
                        , CurrentLang == "ja"
                            ? stx.Text( "Desc_Language_C" )
                            : stx.Text( "Desc_Language_AJ" )
                        , "ja"
                    )
                }
                , ItemAction = ChangeLanguage
                , IsEnabled = true
            };

            if ( MainStage.Instance.IsPhone )
            {
                if ( CurrentLang != "en-US" ) LangSection.Data.ElementAt( 0 ).Desc = "Mobile user may not be able change the language here, please visit the wiki for help";
                if ( CurrentLang != "zh-TW" ) LangSection.Data.ElementAt( 1 ).Desc = "\u624B\u6A5F\u7528\u6236\u53EF\u80FD\u7121\u6CD5\u8B8A\u66F4\u8A9E\u8A00\uFF0C\u8A73\u60C5\u8ACB\u53C3\u770B\u5E6B\u52A9";
                if ( CurrentLang != "zh-CN" ) LangSection.Data.ElementAt( 2 ).Desc = "\u624B\u673A\u7528\u6237\u53EF\u80FD\u65E0\u6CD5\u53D8\u66F4\u8BED\u8A00\uFF0C\u8BE6\u60C5\u8BF7\u53C2\u770B\u5E2E\u52A9";
                if ( CurrentLang != "ja" ) LangSection.Data.ElementAt( 3 ).Desc = "\u643A\u5E2F\u96FB\u8A71\u30E6\u30FC\u30B6\u30FC\u306F\u3001\u8A00\u8A9E\u3092\u5909\u66F4\u3067\u304D\u306A\u3044\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\u8A73\u7D30\u306B\u3064\u3044\u3066\u306F\u3001\u30D8\u30EB\u30D7\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002";
            }

            MainView.ItemsSource = new SettingsSection[]
            {
                new SettingsSection()
                {
                    Title = stx.Text( "Storage" )
                    , Data = new ActiveItem[]
                    {
                        new ActionItem( stx.Text( "Data_Cache"), stx.Text( "Desc_Data_Cache" ), typeof( Data.Cache ) )
                        , new ActionItem( stx.Text( "Data_Illustration"), stx.Text( "Desc_Data_Illustration" ), typeof( Data.Illustration ) )
                        , new ActionItem( stx.Text( "Data_Preload"), stx.Text( "Desc_Data_Preload" ), typeof( Data.Preload ) )
                        , new ActionItem( stx.Text( "EBWin"), stx.Text( "Desc_EBWin_Short" ), typeof( Data.EBWin ) )
                        , OneDriveButton = new ActionItem( "OneDrive", Properties.ENABLE_ONEDRIVE ? stx.Text( "Enabled" ) : stx.Text( "Disabled" ), false )
                        // , new ActionItem( stx.Text( "Data_Connection"), stx.Text( "Desc_Data_Connection" ), typeof( Data.Cache ) )
                    }
                    , ItemAction = PopupSettings
                    , IsEnabled = true
                }
                , new SettingsSection()
                {
                    Title = stx.Text( "Appearance" )
                    , Data = new ActiveItem[]
                    {
                        new ActionItem( stx.Text( "Appearance_ContentReader"), stx.Text( "Desc_Appearance_ContentReader" ), typeof( Themes.ContentReader ) )
                        , new ActionItem( stx.Text( "Appearance_Theme"), stx.Text( "Desc_Appearance_Backgrounds" ), typeof( Themes.ThemeColors ) )
                        , new ActionItem( stx.Text( "Appearance_Layout"), stx.Text( "Desc_Appearance_Layout" ), typeof( Themes.Layout ) )
                    }
                    , ItemAction = PopupSettings
                    , IsEnabled = true
                }
                , LangSection
                , new SettingsSection()
                {
                    Title = stx.Text( "Advanced" )
                    , Data = new ActiveItem[]
                    {
                        new ActionItem( stx.Text( "Advanced_Server"), stx.Text( "Desc_Advanced_Server" ), typeof( Advanced.ServerSelector ) )
                        , new ActionItem( stx.Text( "Advanced_Misc"), stx.Text( "Desc_Advanced_Misc" ), typeof( Advanced.Misc ) )
#if DEBUG || TESTING 
                        , new ActionItem( stx.Text( "Advanced_Debug"), stx.Text( "Desc_Advanced_Debug" ), typeof( Advanced.Debug ) )
#endif
                    }
                    , ItemAction = PopupSettings
                    , IsEnabled = true
                }
                , new SettingsSection()
                {
                    Title = stx.Text( "Help" )
                    , Data = new ActiveItem[]
                    {
                        new ActionItem( stx.Text( "Help_Wiki"), stx.Text( "Desc_Help_Wiki" ), "https://github.com/tgckpg/wenku10/wiki" )
                        , new ActionItem( stx.Text( "Help_Slack"), stx.Text( "Desc_Help_Slack" ), "https://blog.astropenguin.net/article/view/wenku10-%E7%9A%84%E8%A8%8E%E8%AB%96%E7%B5%84/" )
                        , new ActionItem( stx.Text( "Help_BugFeature"), stx.Text( "Desc_Help_BugFeature" ), "https://bugzilla.astropenguin.net/" )
                    }
                    , ItemAction = HelpAction
                    , IsEnabled = true
                }
            };
        }
Example #16
0
        private void SetTemplate()
        {
            AESMgr = new AESManager();
            AESMgr.PropertyChanged += KeyMgr_PropertyChanged;
            TokMgr = new TokenManager();
            TokMgr.PropertyChanged += TokMgr_PropertyChanged;

            Keys.DataContext = AESMgr;
            AccessTokens.DataContext = TokMgr;

            StringResources stx = new StringResources();
            FileName.Text = stx.Text( "PickAFile" );

            Scopes = new NameValue<SpiderScope>[]
            {
                new NameValue<SpiderScope>( stx.Text( "HS_Book" ), SpiderScope.BOOK )
                , new NameValue<SpiderScope>( stx.Text( "HS_Zone" ), SpiderScope.ZONE )
            };

            ScopeLevel.ItemsSource = Scopes;
        }
Example #17
0
        public IEnumerable<SubtleUpdateItem> NavSections()
        {
            IEnumerable<XParameter> Params = IsCustomSectionEnabled
                ? Customs.Where( ( x ) => !x.GetBool( "custom" ) )
                : Customs
                ;

            List<SubtleUpdateItem> Secs = new List<SubtleUpdateItem>();
            StringResources stx = new StringResources( "NavigationTitles" );
            foreach ( XParameter Param in Params )
            {
                Tuple<Type, string> Def = SectionDefs[ Param.Id ];
                Secs.Add(
                    new SubtleUpdateItem(
                        stx.Text( Param.Id ), stx.Text( "Desc_" + Param.Id )
                        , Def.Item1 , Def.Item2
                    )
                );
            }

            return Secs;
        }
Example #18
0
 private void UpdateLLText()
 {
     StringResources stx = new StringResources( "AppResources", "Settings" );
     LLText = LoggedIn ? stx.Text( "Account_Logout", "Settings" ) : stx.Text( "Login" );
     NotifyChanged( "LLText", "LoggedIn" );
 }
Example #19
0
        private async void GotoSettings( object sender, RoutedEventArgs e )
        {
            StringResources stx = new StringResources( "Message", "Settings", "AppBar" );

            bool Go = false;
            MessageDialog Msg = new MessageDialog( stx.Text( "Preface", "Settings" ), stx.Text( "Settings", "AppBar" ) );

            Msg.Commands.Add( new UICommand( stx.Str( "Yes" ), x => Go = true ) );
            Msg.Commands.Add( new UICommand( stx.Str( "No", "Message" ) ) );

            await Popups.ShowDialog( Msg );

            if ( Go )
            {
                Dispose();
                Frame.Navigate( typeof( Pages.Settings.MainSettings ) );
            }
        }
Example #20
0
        private void RequestsStatus( DRequestCompletedEventArgs e, string QId )
        {
            try
            {
                int NGrants = 0;
                int NScripts = 0;
                JsonObject JMesg = JsonStatus.Parse( e.ResponseString );
                JsonArray JData = JMesg.GetNamedArray( "data" );

                if ( 0 < Grants.Count() )
                {
                    List<SHGrant> CurrGrants = new List<SHGrant>( Grants );
                    foreach( JsonValue JValue in JData )
                    {
                        SHGrant G = new SHGrant( JValue.GetObject() );
                        if ( Grants.Any( x => x.Id == G.Id ) ) continue;
                        CurrGrants.Add( G );
                    }
                    Grants = CurrGrants.ToArray();
                }
                else
                {
                    Grants = JData.Remap( x =>
                    {
                        SHGrant G = new SHGrant( x.GetObject() );

                        int l = G.Grants.Length;
                        if ( !G.SourceRemoved )
                        {
                            if ( 0 < l ) NScripts++;
                            NGrants += l;
                        }

                        return G;
                    } );
                }

                if ( 0 < NGrants )
                {
                    AddActivity( () =>
                    {
                        StringResources stx = new StringResources();
                        return string.Format( stx.Text( "GrantsReceived" ), NGrants, NScripts );
                    }, () => MessageBus.SendUI( typeof( SharersHub ), AppKeys.SH_SHOW_GRANTS ) );
                }
            }
            catch ( Exception ex )
            {
                Logger.Log( ID, ex.Message, LogType.WARNING );
            }
        }
Example #21
0
 void UpdateFields()
 {
     StringResources stx = new StringResources( "Settings" );
     illus_Size.Text = stx.Text( "Data_CacheUsed" )
         + ": " + global::wenku8.System.Utils.AutoByteUnit( Shared.Storage.ImageSize() );
 }
Example #22
0
        private void OnBackRequested( object sender, XBackRequestedEventArgs e )
        {
            // Close the settings first
            if ( Overlay.State == ControlState.Reovia )
            {
                Overlay.State = ControlState.Foreatii;
                Settings.Themes.ContentReader Settings = OverlayFrame.Content as Settings.Themes.ContentReader;
                MainSplitView.PanelBackground = ContentPane.BackgroundBrush;
                FocusHelper.DataContext = new AssistContext();

                // If the overlay frame content is settings, and the settings is changed
                if ( Settings != null && Settings.NeedRedraw ) Redraw();

                e.Handled = true;
                return;
            }

            if ( CurrManiState != ManiState.NORMAL || ContentSlideBack.GetCurrentState() == ClockState.Active )
            {
                e.Handled = true;
                ReaderSlideBack();
                return;
            }

            if ( MainSplitView.State == PaneStates.Opened )
            {
                e.Handled = true;
                MainSplitView.ClosePane();
                return;
            }

            StringResources stx = new StringResources( "LoadingMessage" );
            RenderMask.Text = stx.Text( "ProgressIndicator_PleaseWait" );
            RenderMask.HandleBack( Frame, e );
            Dispose();
        }
Example #23
0
 private void SetTemplate()
 {
     StringResources stx = new StringResources( "Settings" );
     CacheLimit.Text = stx.Text( "Data_CacheUsed" )
         + " " + global::wenku8.System.Utils.AutoByteUnit( Shared.Storage.CacheSize() );
 }
Example #24
0
        private void SetTemplateNone()
        {
            StringResources stx = new StringResources();
            TextBlock ButThereIsNothing = new TextBlock();
            ButThereIsNothing.Text = stx.Text( "But_There_Is_Nothing" );
            ButThereIsNothing.TextWrapping = TextWrapping.Wrap;
            ButThereIsNothing.Foreground = new SolidColorBrush(
                global::wenku8.Config.Properties.APPEARENCE_THEME_MAJOR_COLOR
            );
            ButThereIsNothing.TextAlignment = TextAlignment.Center;

            ProgressRing Pring = new ProgressRing();
            Pring.Height = Pring.Width = 40;
            Pring.IsActive = true;

            MasterContainer.Orientation = Orientation.Vertical;
            MasterContainer.HorizontalAlignment = HorizontalAlignment.Center;
            MasterContainer.VerticalAlignment = VerticalAlignment.Center;
            MasterContainer.Children.Add( Pring );
            MasterContainer.Children.Add( ButThereIsNothing );

            Logger.Log( ID, "Everything is disabled, this section will be skipped", LogType.INFO );
            SkipThisPage = true;
        }
Example #25
0
 private async void CalculateTextSize()
 {
     StringResources stx = new StringResources( "Settings" );
     TextContentSize.Text = stx.Text( "Data_CacheUsed" )
         + ": " + await Task.Run( () => global::wenku8.System.Utils.AutoByteUnit( Shared.Storage.GetStaticContentsUsage() ) );
 }
Example #26
0
        private async void DownloadVolume( object sender, RoutedEventArgs e )
        {
            StringResources stx = new StringResources( "ContextMenu", "Message" );

            MessageDialog Msg = new MessageDialog( RightClickedVolume.VolumeTitle, stx.Text( "AutoUpdate" ) );

            bool Confirmed = false;
            Msg.Commands.Add(
                new UICommand( stx.Str( "Yes", "Message" ), ( x ) => Confirmed = true )
            );
            Msg.Commands.Add( new UICommand( stx.Str( "No", "Message" ) ) );

            await Popups.ShowDialog( Msg );

            if ( !Confirmed ) return;

            AutoCache.DownloadVolume( ThisBook, RightClickedVolume );
        }
Example #27
0
        private async void PopupSettings( object P )
        {
            if( P.GetType() == typeof( bool ) )
            {
                StringResources sts = new StringResources( "Settings" );
                if ( !Properties.ENABLE_ONEDRIVE )
                {
                    StringResources stx = new StringResources( "InitQuestions" );
                    StringResources stm = new StringResources( "Message" );
                    MessageDialog Msg = new MessageDialog( stx.Text( "EnableOneDrive" ), "OneDrive" );
                    Msg.Commands.Add(
                        new UICommand( stm.Str( "Yes" ), ( x ) => Properties.ENABLE_ONEDRIVE = true )
                    );
                    Msg.Commands.Add(
                        new UICommand( stm.Str( "No" ), ( x ) => Properties.ENABLE_ONEDRIVE = false )
                    );

                    await Popups.ShowDialog( Msg );

                    if ( Properties.ENABLE_ONEDRIVE )
                    {
                        if ( global::wenku8.Storage.OneDriveSync.Instance == null )
                        {
                            global::wenku8.Storage.OneDriveSync.Instance = new global::wenku8.Storage.OneDriveSync();
                        }
                        await global::wenku8.Storage.OneDriveSync.Instance.Authenticate();
                    }
                    OneDriveButton.Desc = sts.Text( "Enabled" );
                }
                else
                {
                    Properties.ENABLE_ONEDRIVE = false;
                    await global::wenku8.Storage.OneDriveSync.Instance.UnAuthenticate();
                    OneDriveButton.Desc = sts.Text( "Disabled" );
                }

                return;
            }

            PopupFrame.Navigate( ( Type ) P );
            PopupPage.State = ControlState.Reovia;
        }
Example #28
0
        private async void ChangeBackground( object sender, RoutedEventArgs e )
        {
            MenuFlyoutItem item = sender as MenuFlyoutItem;
            string[] Argv = item.Tag.ToString().Split( ',' );

            if ( Argv[ 0 ] == "Preset" )
            {
                bool No = true;

                StringResources stx = new StringResources( "Message", "ContextMenu" );

                MessageDialog MsgBox = new MessageDialog( stx.Str( "BInfoView_PresetBg_Mesg" ), stx.Text( "PresetBackground", "ContextMenu" ) );
                MsgBox.Commands.Add( new UICommand( stx.Str( "Yes" ), x => { No = false; } ) );
                MsgBox.Commands.Add( new UICommand( stx.Str( "No" ) ) );

                await Popups.ShowDialog( MsgBox );

                if ( No ) return;

            }

            LayoutSettings.GetBgContext( Argv[ 1 ] ).SetBackground( Argv[ 0 ] );
        }
Example #29
0
 private async void ShowCommand( Hyperlink sender, HyperlinkClickEventArgs args )
 {
     Logger.Log( ID, AppSettings.FamilyName, LogType.DEBUG );
     StringResources stx = new StringResources( "Settings" );
     await Popups.ShowDialog(
         new Dialogs.Rename(
             new CommandCopy() { Name = "CheckNetIsolation LoopbackExempt -a -n=" + AppSettings.FamilyName }
             , stx.Text( "Advanced_Server_Exempt_Command" ) , true ) );
 }
Example #30
0
 private void IndicateLoad()
 {
     StringResources stx = new StringResources( "LoadingMessage" );
     LoadingRing.IsActive = true;
     LoadingRing.Visibility = Visibility.Visible;
     ServerMessage.Text = stx.Text( "ProgressIndicator_PleaseWait" );
 }