コード例 #1
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var setting = new AppSettingsViewModel();

            this.DefaultViewModel["Audios"]       = setting.Audios;
            this.DefaultViewModel["DefaultAudio"] = setting.AudioSetting;
        }
コード例 #2
0
        public AppSettingsView()
        {
            InitializeComponent();

            asvm = (AppSettingsViewModel)BindingContext;
            asvm.loadSettings();
        }
コード例 #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AppSettingsViewModel appSettingsViewModel)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            //if use sub folder/sub domain
            if (!string.IsNullOrEmpty(appSettingsViewModel.ApplicationFolderApp))
            {
                app.UsePathBase(appSettingsViewModel.ApplicationFolderApp);
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
コード例 #4
0
        public SettingsControl()
        {
            this.InitializeComponent();
            AppSettingsViewModel settingsViewModel = new AppSettingsViewModel(new AppSettingsService(), new GlobalizationService(), new StyleService());

            this.DataContext = settingsViewModel;
        }
コード例 #5
0
        // GET: AppSettings
        public ActionResult Index(string save, string webSockets, string debugView)
        {
            if (!string.IsNullOrWhiteSpace(save))
            {
                Configuration config = WebConfigurationManager.OpenWebConfiguration("/");

                AddOrUpdateSetting(config.AppSettings.Settings, dvKey, debugView);
                AddOrUpdateSetting(config.AppSettings.Settings, wsKey, webSockets);

                config.Save();
            }

            var model = new AppSettingsViewModel
            {
                Choices = new[] {
                    new SelectListItem {
                        Text = "true", Value = "true"
                    },
                    new SelectListItem {
                        Text = "false", Value = "false"
                    }
                },
                DebugView  = WebConfigurationManager.AppSettings.Get(dvKey) ?? "false",
                WebSockets = WebConfigurationManager.AppSettings.Get(wsKey) ?? "true"
            };

            return(View(model));
        }
コード例 #6
0
 public AppSettingsDialog(AppSettings settings)
 {
     Owner = Application.Current.MainWindow;
     InitializeComponent();
     ThemeManager.ApplyThemeToWindow(this, settings.Theme);
     appsvm      = new AppSettingsViewModel(new DefaultDialogService(), new SerializationService(), settings);
     DataContext = appsvm;
 }
コード例 #7
0
        /// <summary>
        /// Preserves state associated with this page in case the application is suspended or the
        /// page is discarded from the navigation cache.  Values must conform to the serialization
        /// requirements of <see cref="SuspensionManager.SessionState"/>.
        /// </summary>
        /// <param name="sender">The source of the event; typically <see cref="NavigationHelper"/></param>
        /// <param name="e">Event data that provides an empty dictionary to be populated with
        /// serializable state.</param>
        private void NavigationHelper_SaveState(object sender, SaveStateEventArgs e)
        {
            var setting = new AppSettingsViewModel();

            var settingAudio = this.DefaultViewModel["DefaultAudio"] as string;

            setting.Save(settingAudio);
        }
コード例 #8
0
 public UsersManager(EjadaContext context, IOptions <AppSettingsViewModel> appSettings, UserManager <User> userManager, IUnitOfWork unitOfWork, ITokenManager tokenManager)
 {
     _unitOfWork   = unitOfWork;
     _context      = context;
     _appSettings  = appSettings.Value;
     _userManager  = userManager;
     _tokenManager = tokenManager;
 }
コード例 #9
0
 public static AppSettingsViewModel ResolveAppSettingsViewModel(IMainController controller)
 {
     if (appSettingsViewModel == null)
     {
         appSettingsViewModel = new AppSettingsViewModel(controller);
     }
     return(appSettingsViewModel);
 }
コード例 #10
0
        public ClientApiService(IConfiguration config, IHttpContextAccessor httpContextAccessor, AppSettingsViewModel appSettings)
        {
            _config = config;
            _httpContextAccessor = httpContextAccessor;
            _appSettings         = appSettings;

            _client = AuthHelper.ClientBearear(_httpContextAccessor, _appSettings);
        }
コード例 #11
0
ファイル: AppSettings.xaml.cs プロジェクト: ITmind/SA1C
        //по другому увы никак
        private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            AppSettingsViewModel vm = DataContext as AppSettingsViewModel;

            if (vm != null)
            {
                vm.Email.SetPassword((sender as PasswordBox).Password);
            }
        }
コード例 #12
0
        public HttpResponseMessage GetAppSettings()
        {
            AppSetting s = _appSettingService.Get();

            // _appSettingService.Save(s);
            AppSettingsViewModel appSettingsViewModel = Mapper.Map <AppSetting, AppSettingsViewModel>(s);
            HttpResponseMessage  response             = Request.CreateResponse(HttpStatusCode.OK, appSettingsViewModel);

            return(response);
        }
コード例 #13
0
 public AppSettings()
 {
     InitializeComponent();
     model = new AppSettingsViewModel()
     {
         InputDirectory  = appSettings.InputDirectoryPath,
         OutputDirectory = appSettings.OutputDirectoryPath
     };
     DataContext = model;
 }
コード例 #14
0
        public IActionResult UpdateConfiguration(AppSettingsViewModel model)
        {
            if (ModelState.IsValid)
            {
                ViewBag.Message = "Configuration Updated.";
                return(RedirectToAction(nameof(Index)));
            }

            return(View("Index"));
        }
コード例 #15
0
        public AccountController(IUnitOfWork unitOfWork,
                                 IUsersManager userService,
                                 IOptions <AppSettingsViewModel> appSettings)
        {
            _usersManager = userService;
            _appSettings  = appSettings.Value;
            _unitOfwork   = unitOfWork;

            _exceptionManager = new ExceptionManager(unitOfWork);
        }
コード例 #16
0
        void SettingsPage_Loaded(object sender, RoutedEventArgs e)
        {
            //await App.MainViewModel.Initialize();
            AppSettingsViewModel settingsViewModel = new AppSettingsViewModel(new AppSettingsService(), new GlobalizationService(), null);

            PageTitle.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);
            PageTitle.Text     = AppResources.Settings;
            this.DataContext   = settingsViewModel;

            /*ObservableCollection<Group<RepoItem>> list = App.MainViewModel.GetLanguages();
             * longList.ItemsSource = list;*/
        }
コード例 #17
0
        public MainWindowViewModel()
        {
            Title                = $"{AppInfo.ProductName} v{AppInfo.DisplayVersion}";
            JoinViewModel        = new JoinViewModel();
            SplitViewModel       = new SplitViewModel();
            HashViewModel        = new HashViewModel();
            AppSettingsViewModel = new AppSettingsViewModel();

            // All tools tab except settings
            _toolsTab = new TabViewModelBase[] { JoinViewModel, SplitViewModel, HashViewModel };

            var tabToSelect = _toolsTab.FirstOrDefault(tab => string.Equals(tab.TabId, Settings.Default.ActiveTabId, StringComparison.OrdinalIgnoreCase));

            SelectedTab = tabToSelect ?? _toolsTab[0];
        }
コード例 #18
0
        void AppSettingsWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var vm = new AppSettingsViewModel();

            this.DataContext = vm;

            if (vm.CloseAction == null)
            {
                vm.CloseAction = new Action(Close);
            }

            if (vm.Window == null)
            {
                vm.Window = this;
            }
        }
コード例 #19
0
 public AppSettingsViewController(IntPtr handle) : base(handle)
 {
     ViewModel = App.Container.Get <AppSettingsViewModel>();
     ViewModel.PropertyChanged += (object sender, PropertyChangedEventArgs e) =>
     {
         if (sender is AppSettingsViewModel viewModel)
         {
             if (!base.IsViewLoaded)
             {
                 return;
             }
             var timeSettings = viewModel.CurrentSettings;
             var now          = DateTimeOffset.Now;
             var dt           = new DateTime(now.Year, now.Month, now.Day, timeSettings.Hour, timeSettings.Minute, 0);
             PickerDefaultTime.SetDate(dt.ToNSDate(), true);
         }
     };
 }
コード例 #20
0
        public SettingsController(ISettingsService settingsService,
                                  ICalendarController calendarController,
                                  SettingsViewModel settingsViewModel,
                                  Lazy <CalendarViewModel> calendarViewModelLazy,
                                  Lazy <ManageProfileViewModel> manageProfileViewModelLazy,
                                  Lazy <TaskViewModel> taskViewModelLazy,
                                  Lazy <AppSettingsViewModel> appSettingsViewModelLazy)
        {
            _calendarController     = calendarController;
            _settingsViewModel      = settingsViewModel;
            _calendarViewModel      = calendarViewModelLazy.Value;
            _taskViewModel          = taskViewModelLazy.Value;
            _manageProfileViewModel = manageProfileViewModelLazy.Value;
            _appSettingsViewModel   = appSettingsViewModelLazy.Value;

            settingsService.TaskView           = _taskViewModel.View;
            settingsService.CalendarView       = _calendarViewModel.View;
            settingsService.ManageProfilesView = _manageProfileViewModel.View;
            settingsService.AppSettingsView    = _appSettingsViewModel.View;
        }
コード例 #21
0
 private void InitDesignTime()
 {
     AppSettings   = new AppSettingsViewModel();
     ImgurSettings = new ImgurSettingsViewModel();
 }
コード例 #22
0
ファイル: AuthHelper.cs プロジェクト: suwanda90/todo-app
        public static string GetToken(HttpClient client, IHttpContextAccessor httpContextAccessor, AppSettingsViewModel appSettingsViewModel)
        {
            var    tokenExpiry = string.Empty;
            string token;

            if (!CookieHelper.IsExistCookie(SecurityHelper.ToBase64Encode(appSettingsViewModel.ApplicationCookiesName + ".Api.Token"), httpContextAccessor) &&
                !CookieHelper.IsExistCookie(SecurityHelper.ToBase64Encode(appSettingsViewModel.ApplicationCookiesName + ".Api.TokenExpiry"), httpContextAccessor))
            {
                token = GenerateToken(client, httpContextAccessor, appSettingsViewModel);
            }
            else
            {
                token       = CookieHelper.GetCookie(SecurityHelper.ToBase64Encode(appSettingsViewModel.ApplicationCookiesName + ".Api.Token"), httpContextAccessor).ToBase64Decode();
                tokenExpiry = CookieHelper.GetCookie(SecurityHelper.ToBase64Encode(appSettingsViewModel.ApplicationCookiesName + ".Api.TokenExpiry"), httpContextAccessor).ToBase64Decode();
            }

            if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(tokenExpiry))
            {
                var dateTimeOffset = DateTime.Parse(tokenExpiry);
                if ((dateTimeOffset - DateTime.Now).TotalSeconds < 60)
                {
                    token = GenerateToken(client, httpContextAccessor, appSettingsViewModel);
                }
            }

            return(token);
        }
コード例 #23
0
ファイル: AuthHelper.cs プロジェクト: suwanda90/todo-app
        private static string GenerateToken(HttpClient client, IHttpContextAccessor httpContextAccessor, AppSettingsViewModel appSettingsViewModel)
        {
            var url = "Auth/token/" + appSettingsViewModel.ApiClientId + "/" + appSettingsViewModel.ApiClientSecret;

            var response = client.GetAsync(url).GetAwaiter().GetResult();

            var content     = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            var tokens      = JsonConvert.DeserializeObject <IDictionary <string, object> >(content);
            var token       = tokens["token"] as string;
            var tokenExpiry = tokens["validTo"] as string;

            CookieHelper.SetCookie(SecurityHelper.ToBase64Encode(appSettingsViewModel.ApplicationCookiesName + ".Api.Token"), token.ToBase64Encode(), 30, httpContextAccessor);
            CookieHelper.SetCookie(SecurityHelper.ToBase64Encode(appSettingsViewModel.ApplicationCookiesName + ".Api.TokenExpiry"), tokenExpiry.ToBase64Encode(), 30, httpContextAccessor);

            return(token);
        }
コード例 #24
0
 public DepartmentManager(IUnitOfWork unitOfWork, IOptions <AppSettingsViewModel> appSettings)
 {
     _unitOfWork  = unitOfWork;
     _appSettings = appSettings.Value;
 }
コード例 #25
0
        public IHttpActionResult Get()
        {
            var model = new AppSettingsViewModel();

            return(Ok(model));
        }
コード例 #26
0
 public UserManager(Code9Context context, IOptions <AppSettingsViewModel> appSettings, IUnitOfWork unitOfWork)
 {
     _unitOfWork  = unitOfWork;
     _context     = context;
     _appSettings = appSettings.Value;
 }
コード例 #27
0
 public EmployeeManager(IUnitOfWork unitOfWork, IOptions <AppSettingsViewModel> appSettings)
 {
     _unitOfWork  = unitOfWork;
     _appSettings = appSettings.Value;
 }
コード例 #28
0
        public void Setup()
        {
            IConfigurationManager <AppSettings> configManager = new ConfigurationManager <AppSettings>();

            _viewModel = new AppSettingsViewModel(configManager);
        }
コード例 #29
0
 public AppSettingsWindow()
 {
     InitializeComponent();
     DataContext = new AppSettingsViewModel();
 }
コード例 #30
0
 public AppSettingsPage(AppSettingsViewModel viewModel)
 {
     InitializeComponent();
     this.viewModel = viewModel;
     DataContext    = this.viewModel;
 }
コード例 #31
0
 public AppSettingsPageViewModel(AppSettingsViewModel settings) : base("Settings", PackIconKind.Settings)
 {
     this.Settings = settings;
 }