public InternationalizationFlow(ITranslationsService service)
        {
            _downloadTranslation = new RemoteActionsCallerForm(x =>
                                                               x.Add(
                                                                   () => _choose.ChosenValue,
                                                                   service.FetchTranslation,
                                                                   y => I18n.ConfigureImplementation(
                                                                       () => new TranslationWithFallbackI18n(_choose.ChosenValue.ToString(), y))));

            _choose = new EnumChoiceForm <SupportedLang>(
                "Language choice",
                true,
                SupportedLang.EN,
                x => x.GetLangName(),
                x => {
                x.Choice.Widget.Style.Display             = Display.Grid;
                x.Choice.Widget.Style.GridTemplateColumns = "auto 1fr";

                x.Description.Widget.InnerHTML =
                    @"For sake of simplicity you need to make explicit choice below. 
In a normal program, you would take current language either from logged in
user property or from browser's Accept-Language header field.
If you study source code you will see that messages eligible for translation are declared as: 
    I18n.Translate(""Some message that should be localized"")
Those messages can be easily found and translated within JSON file using <a target='_blank' href='https://github.com/d-p-y/oldschool-i18n'>OldSchool-I18n</a>";

                x.Description.Widget.Style.WhiteSpace    = WhiteSpace.Pre;
                x.Description.Widget.Style.PaddingBottom = "20px";
                x.Description.Widget.ClassName           = "grayedOut";
            });

            _welcomeDialog = new InformationalMessageForm();
        }
Esempio n. 2
0
 public DataboundDatagridProgram(ISomeService someService)
 {
     _datagrid    = new DataboundDatagridForm();
     _fetchData   = new RemoteActionsCallerForm(o => o.Add(someService.FetchItems, x => _datagrid.Items.Items.Replace(x)));
     _itemCreator = new DataboundDatagridItemCreatorForm(someService);
     _itemEditor  = new DataboundDatagridItemEditorForm(someService);
 }
Esempio n. 3
0
 public UploaderDemoFlow(ISomeService someService, IHttpRequester httpRequester)
 {
     _fetchFiles = new RemoteActionsCallerForm(x => x.Add(
                                                   someService.OrderAttachmentGetFiles,
                                                   y => _files = y));
     _demo   = new UploaderDemoForm(httpRequester);
     _params = new UploaderDemoParamsForm();
     _params.SetParent(_demo.GetUploadControl());
 }
Esempio n. 4
0
 public HelloFlow(IHelloWorldService service)
 {
     _askForName = new TextInputForm("What's your name?", "Hello there");
     _getAnswer  = new RemoteActionsCallerForm(
         x => x.Add(() =>
                    _askForName.Introduced,   //service param
                    service.SayHello,
                    y => _sayHello.Init(y))); //consume service reply
     _sayHello = new InformationalMessageForm();
 }
Esempio n. 5
0
 public HelloWorldFlow(IHelloWorldService service)
 {
     _askForName = new TextInputForm(
         "What's your name?", "Hello there", TextType.TreatAsText, "",
         Validator.IsNotEmptyOrWhitespaceOnly);
     _getAnswer = new RemoteActionsCallerForm(
         x => x.Add(() =>
                    _askForName.Introduced,   //service param
                    service.SayHello,
                    y => _sayHello.Init(y))); //consume service reply
     _sayHello = new InformationalMessageForm("", "Server reply");
 }
        public MasterDetailsProgram(ISomeService someService)
        {
            _fetchData = new RemoteActionsCallerForm(x => {
                x.Add(someService.FetchHeaders, y => _headerItems.Replace(y));
                x.Add(someService.FetchDetails, y => _detailItems.Replace(y));
            });

            _headers = new HeadersForm();
            _details = new DetailsForm();

            _headerItems.Changed += (_, __, ___) => {
                _headers.Headers.Items.Replace(_headerItems);
            };
            _layoutChoice = new EnumChoiceForm <LayoutChoice>(
                "Choose screen layout", true, LayoutChoice.Horizontal, x => x.ToString(),
                x => x.Choice.Widget.ClassList.Add("horizontalOrVerticalChoice"));
        }
Esempio n. 7
0
        private void OnReadyDesktop()
        {
            Document.Title = "Philadelphia Toolkit Demo App";
            VersionInfo versionInfo = null;

            var getVersion = new RemoteActionsCallerForm(x => x.Add(
                                                             () => GetVersion(),
                                                             y => versionInfo = y));

            getVersion.Ended += (x, _) => {
                _renderer.Remove(x);
                new IntroFlow(versionInfo, Document.URL.Contains("skipWelcome")).Run(
                    _renderer,
                    //when IntroFlow ends start MainMenuFlow
                    //in this simplistic demo it is impossible to quit MainMenuFlow
                    () => _di.Resolve <MainMenuFlow>().Run(_renderer)
                    );
            };

            _renderer.AddPopup(getVersion);
        }