/// <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; }
public AppSettingsView() { InitializeComponent(); asvm = (AppSettingsViewModel)BindingContext; asvm.loadSettings(); }
// 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?}"); }); }
public SettingsControl() { this.InitializeComponent(); AppSettingsViewModel settingsViewModel = new AppSettingsViewModel(new AppSettingsService(), new GlobalizationService(), new StyleService()); this.DataContext = settingsViewModel; }
// 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)); }
public AppSettingsDialog(AppSettings settings) { Owner = Application.Current.MainWindow; InitializeComponent(); ThemeManager.ApplyThemeToWindow(this, settings.Theme); appsvm = new AppSettingsViewModel(new DefaultDialogService(), new SerializationService(), settings); DataContext = appsvm; }
/// <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); }
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; }
public static AppSettingsViewModel ResolveAppSettingsViewModel(IMainController controller) { if (appSettingsViewModel == null) { appSettingsViewModel = new AppSettingsViewModel(controller); } return(appSettingsViewModel); }
public ClientApiService(IConfiguration config, IHttpContextAccessor httpContextAccessor, AppSettingsViewModel appSettings) { _config = config; _httpContextAccessor = httpContextAccessor; _appSettings = appSettings; _client = AuthHelper.ClientBearear(_httpContextAccessor, _appSettings); }
//по другому увы никак private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) { AppSettingsViewModel vm = DataContext as AppSettingsViewModel; if (vm != null) { vm.Email.SetPassword((sender as PasswordBox).Password); } }
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); }
public AppSettings() { InitializeComponent(); model = new AppSettingsViewModel() { InputDirectory = appSettings.InputDirectoryPath, OutputDirectory = appSettings.OutputDirectoryPath }; DataContext = model; }
public IActionResult UpdateConfiguration(AppSettingsViewModel model) { if (ModelState.IsValid) { ViewBag.Message = "Configuration Updated."; return(RedirectToAction(nameof(Index))); } return(View("Index")); }
public AccountController(IUnitOfWork unitOfWork, IUsersManager userService, IOptions <AppSettingsViewModel> appSettings) { _usersManager = userService; _appSettings = appSettings.Value; _unitOfwork = unitOfWork; _exceptionManager = new ExceptionManager(unitOfWork); }
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;*/ }
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]; }
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; } }
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); } }; }
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; }
private void InitDesignTime() { AppSettings = new AppSettingsViewModel(); ImgurSettings = new ImgurSettingsViewModel(); }
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); }
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); }
public DepartmentManager(IUnitOfWork unitOfWork, IOptions <AppSettingsViewModel> appSettings) { _unitOfWork = unitOfWork; _appSettings = appSettings.Value; }
public IHttpActionResult Get() { var model = new AppSettingsViewModel(); return(Ok(model)); }
public UserManager(Code9Context context, IOptions <AppSettingsViewModel> appSettings, IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _context = context; _appSettings = appSettings.Value; }
public EmployeeManager(IUnitOfWork unitOfWork, IOptions <AppSettingsViewModel> appSettings) { _unitOfWork = unitOfWork; _appSettings = appSettings.Value; }
public void Setup() { IConfigurationManager <AppSettings> configManager = new ConfigurationManager <AppSettings>(); _viewModel = new AppSettingsViewModel(configManager); }
public AppSettingsWindow() { InitializeComponent(); DataContext = new AppSettingsViewModel(); }
public AppSettingsPage(AppSettingsViewModel viewModel) { InitializeComponent(); this.viewModel = viewModel; DataContext = this.viewModel; }
public AppSettingsPageViewModel(AppSettingsViewModel settings) : base("Settings", PackIconKind.Settings) { this.Settings = settings; }