Ejemplo n.º 1
0
        object IPageUIObjectLoader.GetUIObject(AppSettingsPage page)
        {
            var oldCursor = appSettingsDlg.Cursor;

            try {
                appSettingsDlg.Cursor = Cursors.Wait;
                return(page.UIObject);
            }
            finally {
                appSettingsDlg.Cursor = oldCursor;
            }
        }
Ejemplo n.º 2
0
 public AppSettingsPageVM(AppSettingsPage page, PageContext context)
 {
     if (page == null)
     {
         throw new ArgumentNullException(nameof(page));
     }
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     Page         = page;
     Children     = new List <AppSettingsPageVM>();
     this.context = context;
 }
Ejemplo n.º 3
0
        public AppSettingsViewModel(MainViewModel mainViewModel)
        {
            retryTimer.Elapsed += (sender, e) =>
            {
                if (RetrySeconds > 0)
                {
                    RetrySeconds--;
                }
            };

            if (AppSettings.EnableDiscordBot)
            {
                ApplicationManager.StartDiscordWebSocket();
            }

            MainViewModel   = mainViewModel;
            AppSettingsPage = new AppSettingsPage(this);
            Patrons         = new ObservableCollection <string>(new APIController().GetPatrons());
        }
Ejemplo n.º 4
0
        public MainTabPage()
        {
            Title = AppResources.Main_title;

            var mainPage = new MainPage
            {
                Title = "Home",
                Icon  = "ic_home.png"
            };

            Children.Add(mainPage);

            var uploadsPage = new UploadsQueuePage
            {
                Title = AppResources.Uploads_btn,
                Icon  = "ic_cloud_upload_white_24dp.png"
            };

            Children.Add(uploadsPage);

            var settingsPage = new AppSettingsPage
            {
                Title = AppResources.Main_settings,
                Icon  = "ic_settings.png"
            };

            Children.Add(settingsPage);

            var helpPage = new AppHelpPage
            {
                Title = AppResources.Main_help,
                Icon  = "ic_info_black_24dp.png"
            };

            Children.Add(helpPage);
        }
Ejemplo n.º 5
0
 public AppSettingsViewModel(MainViewModel mainViewModel)
 {
     MainViewModel   = mainViewModel;
     AppSettingsPage = new AppSettingsPage(this);
     Patrons         = new ObservableCollection <string>(new APIController().GetPatrons());
 }
Ejemplo n.º 6
0
        protected async override void OnStart()
        {
            // Handle when your app starts
            bool          hasValidSetup = false;
            App_Settings  appSettings   = App.Database.GetApplicationSettings();
            string        loggiedintechnicianno;
            JT_Technician technician  = null;
            bool          tableExists = false;

            try
            {
                hasValidSetup = await Database.HasValidSetup(appSettings);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                await MainPage.DisplayAlert("Error!", ex.Message, "OK");

                throw;
            }

            tableExists = App.Database.TableExists <JT_Technician>();

            // Are the settings valid?
            if (hasValidSetup)
            {
                // Yes, so move on to the technician login
                //App_Settings appSettings = App.Database.GetApplicatioinSettings();
                loggiedintechnicianno = (appSettings.LoggedInTechnicianNo != null) ? appSettings.LoggedInTechnicianNo : "";

                if (tableExists && loggiedintechnicianno.Length > 0) // we've already established we do && Database.HasDataConnection())
                {
                    technician = App.Database.GetTechnician(appSettings.LoggedInTechnicianDeptNo, appSettings.LoggedInTechnicianNo);
                    if (technician != null)
                    {
                        App.Database.SaveTechnicianAsCurrent(technician);
                        App.Database.CreateDependentTables(technician);

                        MainPage = new MainDashboard();
                    }
                    else
                    {
                        if (Database.HasDataConnection())
                        {
                            Database.CreateGlobalTables();
                        }

                        Thread.Sleep(5000);
                        TechnicianListPageViewModel viewModel = new TechnicianListPageViewModel();
                        viewModel.PropertyChanged += TechnicianListPageViewModel_PropertyChanged;

                        MainPage = new TechnicianListPage(viewModel);
                    }
                }
                else
                {
                    if (Database.HasDataConnection())
                    {
                        Database.CreateGlobalTables();
                    }

                    Thread.Sleep(5000);
                    TechnicianListPageViewModel viewModel = new TechnicianListPageViewModel();
                    viewModel.PropertyChanged += TechnicianListPageViewModel_PropertyChanged;

                    MainPage = new TechnicianListPage(viewModel);
                }
            }
            else
            {
                // Invalid settings, so show the settings page.
                //  Otherwise, data calls will never work.
                AppSettingsPage settingsPage = new AppSettingsPage();
                settingsPage.SettingsSaved += AppSettingsPage_SettingsSaved;

                MainPage = settingsPage;

                return;
            }
        }
Ejemplo n.º 7
0
 public AppSettingsViewModel(MainViewModel mainViewModel)
 {
     MainViewModel   = mainViewModel;
     AppSettingsPage = new AppSettingsPage(this);
 }
Ejemplo n.º 8
0
        private void RegisterBrainTreeHandlers()
        {
            Handle.GET("/braintree", () =>
            {
                RootPage master = (RootPage)Self.GET("/braintree/rootpage");
                return(master);
            });

            Handle.GET("/braintree/rootpage", () =>
            {
                Session session = Session.Current;

                if (session != null && session.Data != null)
                {
                    return(session.Data);
                }

                var standalone = new RootPage();

                if (session == null)
                {
                    session         = new Session(SessionOptions.PatchVersioning);
                    standalone.Html = "/BrainTree/RootPage.html";
                }

                standalone.Session = session;
                return(standalone);
            });

            Handle.GET("/braintree/settings", () =>
            {
                return(Db.Scope(() =>
                {
                    RootPage master = (RootPage)Self.GET("/braintree/rootpage");

                    var page = new AppSettingsPage();

                    var settings = Db.SQL <BrainTreeSettings>("SELECT i FROM BrainTreeSettings i").First;

                    page.Settings.Enviroment.Items.Add(
                        new AppSettingsPage.SettingsJson.EnviromentJson.ItemsElementJson
                    {
                        Value = "Sandbox",
                        Text = "Sandbox"
                    });

                    page.Settings.Enviroment.Items.Add(
                        new AppSettingsPage.SettingsJson.EnviromentJson.ItemsElementJson
                    {
                        Value = "Production",
                        Text = "Production"
                    });

                    if (settings != null)
                    {
                        page.Settings.Enviroment.Selected = settings.Enviroment;
                        page.Settings.MerchantId = settings.MerchantId;
                        page.Settings.PrivateKey = settings.PrivateKey;
                        page.Settings.PublicKey = settings.PublicKey;
                    }

                    master.CurrentPage = page;

                    return master;
                }));
            }, new HandlerOptions {
                SelfOnly = true
            });
        }
Ejemplo n.º 9
0
        private void ChangeSettings_Click(object sender, RoutedEventArgs e)
        {
            AppSettingsPage settings = new AppSettingsPage();

            MainFrame.Content = settings;
        }