Ejemplo n.º 1
0
        private void SetTemplate()
        {
            StringResources stx = new StringResources( "Message" );
            PrimaryButtonText = stx.Str( "OK" );

            MessageBus.OnDelivery += MessageBus_OnDelivery;
        }
Ejemplo n.º 2
0
        private void ContentDialog_PrimaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args )
        {
            args.Cancel = true;

            if ( Keys.SelectedItem == null )
            {
                StringResources stx = new StringResources();
                ServerMessage.Text = "Please Select a key";
                return;
            }

            string PubKey = RSA.SelectedItem.GenPublicKey();
            string Remarks = RemarksInput.Text.Trim();

            if ( string.IsNullOrEmpty( Remarks ) )
            {
                Remarks = RemarksPlaceholder;
            }

            RCache.POST(
                Shared.ShRequest.Server
                , Shared.ShRequest.PlaceRequest( Target, PubKey, BindItem.Id, Remarks )
                , PlaceSuccess
                , ( c, Id, ex ) => { Error( ex.Message ); }
                , false
            );
        }
Ejemplo n.º 3
0
        private EBDictSearch()
        {
            this.InitializeComponent();

            StringResources stx = new StringResources( "Message" );
            PrimaryButtonText = stx.Str( "OK" );
        }
Ejemplo n.º 4
0
        public Register()
        {
            this.InitializeComponent();

            StringResources stx = new StringResources( "AppResources", "ContextMenu" );
            PrimaryButtonText = stx.Text( "Register", "ContextMenu" );
            SecondaryButtonText = stx.Text( "Button_Back");
        }
Ejemplo n.º 5
0
        public ReviewsInput( BookItem B )
            :this()
        {
            IsReview = false;

            StringResources stx = new StringResources( "AppBar" );
            Title.Text = stx.Str( "AddComment" );
        }
Ejemplo n.º 6
0
        public ChangePassword()
        {
            this.InitializeComponent();

            StringResources stx = new StringResources( "Message" );
            PrimaryButtonText = stx.Str( "OK" );
            SecondaryButtonText = stx.Str( "Cancel" );
        }
Ejemplo n.º 7
0
 private void SetTemplate()
 {
     StringResources stx = new StringResources( "LoadingMessage" );
     CoverSize.Text = stx.Str( "Calculating" );
     CalculateCoverSize();
     TextContentSize.Text = stx.Str( "Calculating" );
     CalculateTextSize();
 }
Ejemplo n.º 8
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" );
        }
Ejemplo n.º 9
0
        private void SetTemplate()
        {
            StringResources stx = new StringResources( "/libtaotu/Message" );
            PrimaryButtonText = stx.Str( "OK" );
            SecondaryButtonText = stx.Str( "Cancel" );

            InputTitle.Text = Param.Caption;
            LayoutRoot.DataContext = Param;
        }
Ejemplo n.º 10
0
        public ReviewsInput( Review R )
            :this()
        {
            IsReview = true;

            StringResources stx = new StringResources( "AppBar" );
            Title.Text = stx.Text( "Reply" );
            TitleSection.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 11
0
        private void DetectInputLogin()
        {
            string Name = Account.Text.Trim();
            string Passwd = Password.Password;
            string PasswdV = PasswordV.Password;
            string Email = EmailInput.Text.Trim();

            if ( string.IsNullOrEmpty( Name ) || string.IsNullOrEmpty( Passwd ) || string.IsNullOrEmpty( PasswdV ) || string.IsNullOrEmpty( Email ) )
            {
                if ( string.IsNullOrEmpty( Name ) )
                {
                    Account.Focus( FocusState.Keyboard );
                }
                else if ( string.IsNullOrEmpty( Passwd ) )
                {
                    Password.Focus( FocusState.Keyboard );
                }
                else if( string.IsNullOrEmpty( PasswdV ) )
                {
                    PasswordV.Focus( FocusState.Keyboard );
                }
                else if( string.IsNullOrEmpty( Email ) )
                {
                    EmailInput.Focus( FocusState.Keyboard );
                }
            }
            else if( Passwd != PasswdV )
            {
                StringResources stx = new StringResources( "Error" );
                ServerMessage.Text = stx.Str( "PasswordMismatch" );
                Password.Focus( FocusState.Keyboard );
            }
            else
            {
                ServerMessage.Text = "";

                IsPrimaryButtonEnabled
                    = IsSecondaryButtonEnabled
                    = Account.IsEnabled
                    = Password.IsEnabled
                    = PasswordV.IsEnabled
                    = EmailInput.IsEnabled
                    = false
                    ;

                this.Focus( FocusState.Pointer );

                IndicateLoad();

                RuntimeCache RCache = new RuntimeCache() { EN_UI_Thead = true };
                RCache.POST(
                    Shared.ShRequest.Server
                    , Shared.ShRequest.Register( Name, Passwd, Email )
                    , RequestComplete, RequestFailed, false );
            }
        }
Ejemplo n.º 12
0
        private void SetTemplate( ColorItem BindColor )
        {
            StringResources stx = new StringResources( "Message" );

            PrimaryButtonText = stx.Str( "OK" );
            SecondaryButtonText = stx.Str( "Cancel" );
            // PresetColors
            PresetColors.ItemsSource = global::wenku8.System.ThemeManager.PresetColors();

            UpdateColor( BindColor );
        }
Ejemplo n.º 13
0
        public Announcements()
        {
            this.InitializeComponent();

            StringResources stx = new StringResources( "Message" );
            PrimaryButtonText = stx.Str( "AllRead" );
            SecondaryButtonText = stx.Str( "OK" );

            FullVersion.Text = global::wenku8.Config.AppSettings.Version;
            version.Text = global::wenku8.System.Bootstrap.Version;

            SetTemplate();
        }
Ejemplo n.º 14
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;
        }
Ejemplo n.º 15
0
        public async Task<bool> Validate()
        {
            global::wenku8.SelfCencorship SS = new global::wenku8.SelfCencorship();

            string Cont = "";

            Editor.Document.GetText( Windows.UI.Text.TextGetOptions.None, out Cont );
            Cont = Cont.Trim();

            if ( !await SS.Passed( Cont ) ) return false;

            string Title = BTitle.Text.Trim();
            if ( !await SS.Passed( Title ) ) return false;

            string Msg;
            StringResources stx = new StringResources();

            if( !IsReview && Title.Length < MinTitleLimit )
            {
                Msg = stx.Text( "Reviews_MinLimit" )
                    + stx.Text( "Desc_Reviews_Title_A" )
                    + MinTitleLimit.ToString()
                    + stx.Text( "Desc_Reviews_Title_B" )
                    ;

                await Popups.ShowDialog(
                    new Windows.UI.Popups.MessageDialog( Msg )
                );

                return false;
            }

            if( Cont.Length < MinContentLimit )
            {
                Msg = stx.Text( "Reviews_MinLimit" )
                    + stx.Text( "Desc_Reviews_Title_A" )
                    + MinContentLimit.ToString()
                    + stx.Text( "Desc_Reviews_Content_B" )
                    ;
                await Popups.ShowDialog(
                    new Windows.UI.Popups.MessageDialog( Msg )
                );
                return false;
            }

            RTitle = GetPrefix() + Title;
            RContent = Cont + GetSuffix();

            return true;
        }
Ejemplo n.º 16
0
        private void DetectInputLogin()
        {
            string CurrPasswd = CurrentPassword.Password;
            string NewPasswd = Password.Password;
            string PasswdV = PasswordV.Password;

            if ( string.IsNullOrEmpty( CurrPasswd ) || string.IsNullOrEmpty( NewPasswd ) || string.IsNullOrEmpty( PasswdV ) )
            {
                if ( string.IsNullOrEmpty( CurrPasswd ) )
                {
                    CurrentPassword.Focus( FocusState.Keyboard );
                }
                else if ( string.IsNullOrEmpty( NewPasswd ) )
                {
                    Password.Focus( FocusState.Keyboard );
                }
                else if( string.IsNullOrEmpty( PasswdV ) )
                {
                    PasswordV.Focus( FocusState.Keyboard );
                }
            }
            else if( NewPasswd != PasswdV )
            {
                StringResources stx = new StringResources( "Error" );
                ServerMessage.Text = stx.Str( "PasswordMismatch" );
                Password.Focus( FocusState.Keyboard );
            }
            else
            {
                ServerMessage.Text = "";

                IsPrimaryButtonEnabled
                    = IsSecondaryButtonEnabled
                    = CurrentPassword.IsEnabled
                    = Password.IsEnabled
                    = PasswordV.IsEnabled
                    = false
                    ;

                this.Focus( FocusState.Pointer );

                IndicateLoad();

                RuntimeCache RCache = new RuntimeCache() { EN_UI_Thead = true };
                RCache.POST(
                    Shared.ShRequest.Server
                    , Shared.ShRequest.ChangePassword( CurrPasswd, NewPasswd )
                    , RequestComplete, RequestFailed, false );
            }
        }
Ejemplo n.º 17
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;
        }
Ejemplo n.º 18
0
        public AssignAuth( StringAuthManager Mgr, string Title )
        {
            this.InitializeComponent();

            this.Title = Title;
            Canceled = true;
            AuthMgr = Mgr;

            StringResources stx = new StringResources( "Message" );

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

            SetTemplate();
        }
Ejemplo n.º 19
0
        public PlaceRequest( SHTarget Target, HubScriptItem HSI, string Placeholder )
        {
            this.InitializeComponent();

            StringResources stx = new StringResources( "Message" );

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

            this.Target = Target;

            Canceled = true;
            BindItem = HSI;
            RemarksPlaceholder = Placeholder;

            SetTemplate();
        }
Ejemplo n.º 20
0
        public NameValueInput( NameValue<string> Item
            , string Title
            , string NameLabel, string ValueLabel
            , string BtnLeft = "OK", string BtnRight = "Cancel" )
        {
            this.InitializeComponent();

            Canceled = true;
            Target = Item;

            StringResources stx = new StringResources( "Message" );
            PrimaryButtonText = stx.Str( BtnLeft );
            SecondaryButtonText = stx.Str( BtnRight );

            TitleText.Text = Title;
            NameLbl.Text = NameLabel;
            ValueLbl.Text = ValueLabel;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// An alias ProcPanel.RSTR
        /// </summary>
        public static string RSTR( string key, params object[] args )
        {
            if ( stp == null )
            {
                stp = new StringResources( "/libtaotu/PanelMessage" );
            }

            try
            {
                string s = string.Format( stp.Str( key ), args );
                return s;
            }
            catch ( Exception ex )
            {
                Logger.Log( "RSTR", ex.Message, LogType.WARNING );
            }

            return key;
        }
Ejemplo n.º 22
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;
            }
        }
Ejemplo n.º 23
0
 private void SetTemplate()
 {
     StringResources stx = new StringResources( "/libtaotu/Message" );
     PrimaryButtonText = stx.Str( "OK" );
 }
Ejemplo n.º 24
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 ) );
 }
Ejemplo n.º 25
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 = "";
            }
        }
Ejemplo n.º 26
0
 private void SetTemplate()
 {
     StringResources stx = new StringResources( "Settings" );
     CacheLimit.Text = stx.Text( "Data_CacheUsed" )
         + " " + global::wenku8.System.Utils.AutoByteUnit( Shared.Storage.CacheSize() );
 }
Ejemplo n.º 27
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() ) );
 }
Ejemplo n.º 28
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
                }
            };
        }
Ejemplo n.º 29
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;
        }
Ejemplo n.º 30
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;
        }