/// <summary> /// 自分自身をDisposeします。 /// </summary> /// <param name="disposing">Dispose中かを表すbool。</param> protected override void Dispose(bool disposing) { base.Dispose(disposing); // アプリケーション設定を保存 AppSettingsService.SaveSettings((ImaZipCoreProto01Settings)this.appSettings); }
public static void Main(string[] args) { AppSettingsService app = new AppSettingsService(); Console.WriteLine(app.Costco.Dir.Encrypt.Orders.FileSpec("file.ext")); Console.ReadKey(); }
public void SaveCurrentSettings(AppSettingsService currentSettings) { if (RadioButtonIsChecked(rdBroadcast)) { currentSettings.ConnectionMode = ClientMode.Broadcast; } else if (RadioButtonIsChecked(rdHttp)) { currentSettings.ConnectionMode = ClientMode.HttpDirect; } else { currentSettings.ConnectionMode = ClientMode.None; } currentSettings.TitleHttp = txtHttpTitle.Text ?? "PROJECT ARYA"; currentSettings.IpAddressHttp = txtHttpAddress.Text ?? "192.168.1.9"; currentSettings.PortHttp = txtHttpPort.Text ?? "3000"; currentSettings.PortBroadcast = txtBroadcastPort.Text ?? "3000"; currentSettings.TitleNone = txtTitleNone.Text ?? "PROJECT ARYA"; currentSettings.HideMissionButtons = CheckBoxIsChecked(chkHideMissionControls); currentSettings.LaunchRemoteDesktop = CheckBoxIsChecked(chkLaunchIoTRemote); currentSettings.ProjectOutput = CheckBoxIsChecked(chkLaunchProjector); }
private async Task AuthenticateAsync() { var appSettingsService = new AppSettingsService(); var azureService = DependencyService.Get <IAzureService>(); if (azureService.GetMobileServicesClinet().CurrentUser == null) { string userId; string token; if (appSettingsService.TryGetValue(AuthenticaitonTokenKey, out token) && appSettingsService.TryGetValue(UserIdKey, out userId)) { var user = new MobileServiceUser(userId); user.MobileServiceAuthenticationToken = token; azureService.GetMobileServicesClinet().CurrentUser = user; if (await GetCurrentUserInfoAsync(azureService)) { return; } } await LoginAsync(appSettingsService, azureService); } }
public void PopulateCurrentSettings(AppSettingsService currentSettings) { switch (currentSettings.ConnectionMode) { case ClientMode.HttpDirect: rdHttp.IsChecked = true; break; case ClientMode.Broadcast: rdBroadcast.IsChecked = true; break; case ClientMode.None: rdNone.IsChecked = true; break; } txtHttpTitle.Text = currentSettings.TitleHttp ?? "PROJECT ARYA"; txtHttpAddress.Text = currentSettings.IpAddressHttp ?? "192.168.1.9"; txtHttpPort.Text = currentSettings.PortHttp ?? "3000"; txtBroadcastPort.Text = currentSettings.PortBroadcast ?? "3000"; txtTitleNone.Text = currentSettings.TitleNone ?? "PROJECT ARYA"; chkHideMissionControls.IsChecked = currentSettings.HideMissionButtons; chkLaunchIoTRemote.IsChecked = currentSettings.LaunchRemoteDesktop; chkLaunchProjector.IsChecked = currentSettings.ProjectOutput; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IConfiguration configuration) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseSwagger(); IAppSettingsService appSettingsService = new AppSettingsService(Configuration); app.UseSwaggerUI(c => { var swaggerUIPage = _appSettingsService.SwaggerUIPage; c.SwaggerEndpoint(swaggerUIPage, "Test Engine Service Api V1"); c.RoutePrefix = string.Empty; }); app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.UseCookiePolicy(); app.UseMvc(); }
public static IContainer CreateContainer() { string settingsFolderPath = ApplicationBuildConfig.UserDataPath; string iniConfigFilePath = Path.Combine(ApplicationBuildConfig.UserDataPath, "ApplicationSettings.ini"); var appSettings = new AppSettingsService(ConfigHelper.GetDefaultSettings(), new IniConfigFileManager(), iniConfigFilePath); var memoStorageService = new MemoStorageService(appSettings, settingsFolderPath); // Create autofac container var builder = new ContainerBuilder(); builder.RegisterInstance(appSettings).As <AppSettingsService>(); builder.RegisterInstance(memoStorageService).As <MemoStorageService>(); var generalToolKitAssembly = AssemblyHelper.GetAssembly(); if (generalToolKitAssembly != null) { builder.RegisterAssemblyModules(generalToolKitAssembly); } builder.RegisterAssemblyModules(Assembly.GetCallingAssembly()); var container = builder.Build(); return(container); }
public override void Init(object initData) { base.Init(initData); var systemSettings = AppSettingsService.Get <SystemSettings>(MyAppConstants.SystemSettings); if (!systemSettings.PortalDisableMyWork) { MenuPageItems.Add(new MenuPageItem { Title = "My Tasks", Icon = "menu_1.png", PageType = typeof(DashboardPageModel), WidgetConfiguration = WidgetConfigurations.MyTasksWidgetConfiguration }); } if (!systemSettings.PortalDisableMyRecords) { MenuPageItems.Add(new MenuPageItem { Title = "My Records", Icon = "menu_2.png", PageType = typeof(DashboardPageModel), WidgetConfiguration = WidgetConfigurations.MyRecordsWidgetConfiguration }); } if (!systemSettings.PortalDisableIncidents) { MenuPageItems.Add(new MenuPageItem { Title = "Event Reports", Icon = "menu_3.png", PageType = typeof(DashboardPageModel), WidgetConfiguration = WidgetConfigurations.EventReportsWidgetConfiguration }); } MenuPageItems.Add(new MenuPageItem { Title = "Offline", Icon = "menu_4.png", PageType = typeof(MainTabPageModel), WidgetConfiguration = WidgetConfigurations.MyTasksWidgetConfiguration }); }
static void Main(string[] args) { if (args == null || args.Length == 0) { Console.WriteLine("1 args required"); return; } var path = args[0]; var zip = args.Length > 1 ? Boolean.TrueString.ToLower() == args[1].ToLower() : false; if (zip) { Console.WriteLine("zip will be enabled"); } var cancelToken = new CancellationTokenSource(); Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { e.Cancel = true; cancelToken.Cancel(true); }; var config = AppSettingsService.BuildConfiguration("appsettings.json"); var services = new ServiceCollection(); services.AddAppServices(config); services.AddSingleton <UploadManager>(); var serviceProvider = services.BuildGlobalServices(bulder => { bulder.RegisterGeneric(typeof(Logger <>)).As(typeof(ILogger <>)).SingleInstance(); }); serviceProvider.GetService <UploadManager>().UploadAll(path, zip, cancelToken.Token).Wait(); }
protected override async Task OnInitializedAsync() { try { EmployeeService = ScopedServices.GetRequiredService <IEmployeeService>(); LdapService = ScopedServices.GetRequiredService <ILdapService>(); RemoteDeviceConnectionsService = ScopedServices.GetRequiredService <IRemoteDeviceConnectionsService>(); Account = await EmployeeService.GetAccountByIdAsync(AccountId); if (Account == null) { throw new HESException(HESCode.AccountNotFound); } EntityBeingEdited = MemoryCache.TryGetValue(Account.Id, out object _); if (!EntityBeingEdited) { MemoryCache.Set(Account.Id, Account); } Employee = await EmployeeService.GetEmployeeByIdAsync(Account.EmployeeId); LdapSettings = await AppSettingsService.GetLdapSettingsAsync(); SetInitialized(); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
protected override async Task OnInitializedAsync() { try { LdapService = ScopedServices.GetRequiredService <ILdapService>(); GroupService = ScopedServices.GetRequiredService <IGroupService>(); LdapSettings = await AppSettingsService.GetLdapSettingsAsync(); if (LdapSettings == null) { ActiveDirectoryInitialization = ActiveDirectoryInitialization.HostNotSet; } else if (LdapSettings?.Host != null && LdapSettings?.UserName == null && LdapSettings?.Password == null) { ActiveDirectoryInitialization = ActiveDirectoryInitialization.CredentialsNotSet; } else { await GetGroups(LdapSettings); } SetInitialized(); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CancelAsync(); } }
private async Task SaveSettingsAsync() { try { var isValid = LdapSettingsContext.Validate(); if (!isValid) { return; } await LdapService.ValidateCredentialsAsync(LdapSettings); await AppSettingsService.SetLdapSettingsAsync(LdapSettings); await ToastService.ShowToastAsync("Domain settings updated.", ToastType.Success); await ModalDialogClose(); } catch (LdapForNet.LdapInvalidCredentialsException) { ValidationErrorMessage.DisplayError(nameof(LdapSettings.Password), "Invalid password"); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async void Page_LoadedAsync(object sender, RoutedEventArgs e) { _viewModel.appLog.Info(this.GetType().ToString(), "MainPage Loaded."); CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar; titleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged; BackToEmpty(); navigationViewItemForegroundDefault = navigationViewItemDatasets.Foreground; string lastDataset = AppSettingsService.RetrieveFromSettings <string>("WorkingDataset", ""); if (lastDataset != "") { List <Site> siteList = await LocalMetadataService.LoadSitesAsync(); List <Dataset> datasetList = await LocalMetadataService.LoadDatasetsAsync(siteList); Dataset dataset = datasetList.Find(x => x.Name == lastDataset); if (dataset == null) { return; } MessageDialog dlg = new MessageDialog("Do you want to load dataset " + lastDataset + " ?", "Load Dataset"); dlg.Commands.Add(new UICommand("Yes")); dlg.Commands.Add(new UICommand("No")); IUICommand selectedCmd = await dlg.ShowAsync(); if (selectedCmd.Label == "Yes") { MainFrameNavigate(typeof(DatasetViewPage), dataset); } } }
public DefaultAutoFetchHandler(IAppSettingsService appSettingsService, IRepositoryInformationAggregator repositoryInformationAggregator, IRepositoryWriter repositoryWriter) { AppSettingsService = appSettingsService ?? throw new ArgumentNullException(nameof(appSettingsService)); RepositoryInformationAggregator = repositoryInformationAggregator ?? throw new ArgumentNullException(nameof(repositoryInformationAggregator)); RepositoryWriter = repositoryWriter ?? throw new ArgumentNullException(nameof(repositoryWriter)); AppSettingsService.RegisterInvalidationHandler(() => Mode = AppSettingsService.AutoFetchMode); _profiles = new Dictionary <AutoFetchMode, AutoFetchProfile> { { AutoFetchMode.Off, new AutoFetchProfile() { PauseBetweenFetches = TimeSpan.MaxValue } }, { AutoFetchMode.Discretely, new AutoFetchProfile() { PauseBetweenFetches = TimeSpan.FromMinutes(5) } }, { AutoFetchMode.Adequate, new AutoFetchProfile() { PauseBetweenFetches = TimeSpan.FromMinutes(1) } }, { AutoFetchMode.Aggresive, new AutoFetchProfile() { PauseBetweenFetches = TimeSpan.FromSeconds(2) } } }; _timer = new Timer(FetchNext, null, Timeout.Infinite, Timeout.Infinite); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args).ConfigureAppConfiguration(configBuilder => { AppSettingsService.AppendConfigurations(configBuilder, "appsettings.json"); }).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseUrls("http://*:14101").UseStartup <Startup>(); });
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var appSettingsService = new AppSettingsService(ConfigHelper.GetConfiguration()); Application.Run(new FormMain(args, appSettingsService)); }
public DatasetEventsPage() { this.InitializeComponent(); sensorIconWidth = AppSettingsService.RetrieveFromSettings <double>("sensorIconWidth", 10); sensorIconHeight = AppSettingsService.RetrieveFromSettings <double>("sensorIconHeight", 10); sensorTextWidth = AppSettingsService.RetrieveFromSettings <double>("sensorTextWidth", 60); sensorTextHeight = AppSettingsService.RetrieveFromSettings <double>("sensorTextHeight", 20); }
private async Task ConnectAsync() { if (SaveCredentials) { await AppSettingsService.SetLdapSettingsAsync(LdapSettings); } await LoadEntities.Invoke(LdapSettings); }
private async Task LoadLdapSettingsAsync() { var ldapSettings = await AppSettingsService.GetLdapSettingsAsync(); if (ldapSettings?.Password != null) { LdapHost = ldapSettings.Host.Split(".")[0]; } }
public DynamicResourcesConverter() { if (DesignMode.DesignModeEnabled) { return; } _appSettings = ServiceLocator.Current.GetInstance <AppSettingsService>(); }
/// <summary> /// Der Konstruktor wird private gesetzut. Die Klasse kann nun von /// außen nicht mehr instanziert werden. /// </summary> /// <remarks> /// In dieser Methode wird <code>AppSettingsService</code> verwendet um die Base-Url /// zur API aus der appsettings.config zu laden und zu setzen. /// </remarks> private RestService() { Assembly assembly = GetType().Assembly; AppSettingsService appSettingsServiceBase = new AppSettingsService(); appSettingsServiceBase.Assembly = assembly; base.BaseUrl = appSettingsServiceBase.Get("ServiceUrl"); }
/// <summary> /// Initializes a new instance of the <see cref="MainFormLogicManager" /> class. /// </summary> /// <param name="memoStorageService">The memo storage service.</param> /// <param name="fileStorageService">The file storage service.</param> /// <param name="passwordStorage">The password storage.</param> /// <param name="scope">The scope.</param> /// <param name="appSettingsService">The application settings service.</param> public MainFormLogicManager(MemoStorageService memoStorageService, FileStorageService fileStorageService, PasswordStorage passwordStorage, ILifetimeScope scope, AppSettingsService appSettingsService) { _memoStorageService = memoStorageService; _fileStorageService = fileStorageService; _scope = scope; _appSettingsService = appSettingsService; _passwordStorage = passwordStorage; _tabPageDataCollection = TabPageDataCollection.CreateNewPageDataCollection(_appSettingsService.Settings.DefaultEmptyTabPages); }
public SubscriptionsPageViewModel([NotNull] INavigationService navigationService, [NotNull] ApiClient apiClient, [NotNull] AppSettingsService settingsService, [NotNull] TelemetryClient telemetryClient, [NotNull] TileManager tileManager, [NotNull] LocalStorageManager localStorageManager, [NotNull] SubscriptionsManager subscriptionsManager, [NotNull] NetworkManager networkManager) { if (navigationService == null) { throw new ArgumentNullException("navigationService"); } if (apiClient == null) { throw new ArgumentNullException("apiClient"); } if (settingsService == null) { throw new ArgumentNullException("settingsService"); } if (telemetryClient == null) { throw new ArgumentNullException("telemetryClient"); } if (tileManager == null) { throw new ArgumentNullException("tileManager"); } if (localStorageManager == null) { throw new ArgumentNullException("localStorageManager"); } if (subscriptionsManager == null) { throw new ArgumentNullException("subscriptionsManager"); } if (networkManager == null) { throw new ArgumentNullException("networkManager"); } _navigationService = navigationService; _apiClient = apiClient; _settingsService = settingsService; _telemetryClient = telemetryClient; _tileManager = tileManager; _localStorageManager = localStorageManager; _subscriptionsManager = subscriptionsManager; _networkManager = networkManager; _dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; Application.Current.Resuming += Application_Resuming; _networkManager.NetworkChanged += _networkManager_NetworkChanged; }
public async void SaveSettings() { AppSettingsService.SaveSetting(AppSettingsService.DEFAULT_LOCATION_MODE, DefaultLocationMode); if (DefaultLocationMode == 1) { AppSettingsService.SaveSetting(AppSettingsService.DEFAULT_LOCATION, DefaultLocation); AppSettingsService.SaveSetting(AppSettingsService.DEFAULT_LOCATION_FULL_NAME, DefaultLocationFullName); } await new MessageDialog("Settings Saved.").ShowAsync(); }
public WeatherViewModel() { Status = 0; IsLoading = false; if (!AppSettingsService.ContainsSetting(AppSettingsService.TEMPERATURE_UNIT)) { AppSettingsService.SaveSetting(AppSettingsService.TEMPERATURE_UNIT, true); } }
public FilPanDbContext CreateDbContext(string[] args) { var config = AppSettingsService.BuildConfiguration("appsettings.json"); var services = new ServiceCollection(); services.AddAppServices(config); var serviceProvider = services.BuildGlobalServices(); return(serviceProvider.GetService <FilPanDbContext>()); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; AppSettingsService.Initialize(); App.Current.RequestedTheme = (int)AppSettingsService.GetSetting(AppSettingsService.THEME_SETTINGS) == 0 ? ApplicationTheme.Dark : ApplicationTheme.Light; }
public AppSettingController(AppSettingsService appSettingsService, INotificationService notificationService, ILibFileProvider fileProvider, IMapper mapper) { _appSettingsService = appSettingsService; _notificationService = notificationService; _fileProvider = fileProvider; _mapper = mapper; }
protected override void OnStartup(StartupEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } try { base.OnStartup(e); var appSettingsService = new AppSettingsService(); var processSignal = new CrossProcessSignal(IAppSettingsService.ReloadEventName); if (e.Args.FirstOrDefault() == "deskband-test") { this._loggerFactory = LoggerConfiguration.CreateLoggerFactory( LogLevel.Information, appSettingsService.GetLogFilePath("DeskbandTest"), this._logLevelSignal); this._log = this._loggerFactory.CreateLogger(this.GetType().Name); this.MainWindow = new DeskbandTestWindow( this._loggerFactory, this._logLevelSignal, appSettingsService, processSignal); } else { this._loggerFactory = LoggerConfiguration.CreateLoggerFactory( LogLevel.Information, appSettingsService.GetLogFilePath("Settings"), this._logLevelSignal); this._log = this._loggerFactory.CreateLogger(this.GetType().Name); this.MainWindow = new SettingsWindow( this._loggerFactory, this._logLevelSignal, appSettingsService, processSignal); } this.MainWindow.Show(); } catch (Exception ex) { this._log?.LogError(ex, "MonBand initialization failed"); MessageBox.Show( ex.Message, "MonBand initialization failed", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void onSaveSettings() { var settings = new ImaZipCoreProto01Settings() { SourceFileSelectedFilter = "アーカイブファイル(*.zip,*.rar)|*.zip;*.rar", CreatorExeFileName = "ZipBookCreator" }; AppSettingsService.SaveSettings(settings, @"D:\MyDocuments\GitHubRepositories\WpfMvvmLabo\ImaZipperProto\ImaZipCoreProto01\bin\Debug\netcoreapp3.0\Settings\ImaZipCoreProto01Settings.xml"); MessageBox.Show("保存!"); }