protected override void OnNavigatingFrom(MtNavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); if (e.NavigationMode == NavigationMode.Back) { //mainGridThread.Children.Remove(myWebview); this.NavigationCacheMode = NavigationCacheMode.Disabled; helper = null; bookMark = null; thread = null; myLogin = null; define = null; appSetting = null; threadController = null; myWebview = null; tbMessage.Text = Resource.STR_EMPTY; if (wbPopup != null) { wbPopup.Navigate(new Uri("about:blank")); wbPopup = null; } _instance = null; GC.Collect(); } else { if (wbPopup != null) { wbPopup.Navigate(new Uri("about:blank")); } } }
public ThreadView() { this.InitializeComponent(); CurrentPage = 1; appBar.Width = ActualWidth; btnPopupPostMessage.IsEnabled = false; BtnRating.IsEnabled = false; comment.IsEnabled = false; bookMark = new BookmarkModelData(); helper = new HtmlHelper(); thread = new ThreadModel(); myLogin = new AccountHelper(); define = new DefineEmoticon(); appSetting = new AppSettingModel(); threadController = new ThreadController(); if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.FrameworkElement", "AllowFocusOnInteraction")) { fl_Page.AllowFocusOnInteraction = true; tbMessage.AllowFocusOnInteraction = true; jumpTextBox.AllowFocusOnInteraction = true; getIdthread.AllowFocusOnInteraction = true; } _instance = this; //this.NavigationCacheMode = NavigationCacheMode.Enabled; }
/// <summary> /// Ask to change theme for app /// </summary> /// <param name="isDarkTheme"></param> public static async void AskToChangeThemeApp(bool isDarkTheme) { var msg = new MessageDialog("Restart app to apply effect!"); var okBtn = new UICommand(Resource.OK); var cancelBtn = new UICommand(Resource.NOK); msg.Commands.Add(okBtn); msg.Commands.Add(cancelBtn); IUICommand result = await msg.ShowAsync(); if (result != null && result.Label == Resource.OK) { AppSettingModel appSetting = new AppSettingModel(); if (isDarkTheme) { appSetting.ThemeSetting = "Dark"; } else { appSetting.ThemeSetting = "Light"; } Windows.UI.Xaml.Application.Current.Exit(); } }
public MainPage() { this.InitializeComponent(); appSetting = new AppSettingModel(); loginModel = new AccountModel(); this.NavigationCacheMode = NavigationCacheMode.Required; Vozforumsapp.Text = "Vozforums App © " + DateTime.Now.Year.ToString(); //if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView")) //{ // var titleBar = ApplicationView.GetForCurrentView().TitleBar; // if (titleBar != null) // { // titleBar.ButtonBackgroundColor = Colors.DarkBlue; // titleBar.ButtonForegroundColor = Colors.White; // titleBar.BackgroundColor = Colors.Blue; // titleBar.ForegroundColor = Colors.White; // } //} if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { var statusBar = StatusBar.GetForCurrentView(); if (statusBar != null) { statusBar.BackgroundOpacity = 1; statusBar.BackgroundColor = Colors.Black; statusBar.ForegroundColor = Colors.White; } } }
public RabbitService(IOptions <AppSettingModel> settings, IOptions <SeriLogSetting> seriLogSetting, IServiceProvider serviceProvider) { _settings = settings.Value; _serviceProvider = serviceProvider; _seriLogSetting = seriLogSetting.Value; _seriLogSettingOptions = seriLogSetting; }
public static void Load(string env) { if (Settings != null) { return; } var evnSuffix = string.IsNullOrWhiteSpace(env) ? string.Empty : $".{env}"; var settingFile = $"appsettings{evnSuffix}.json"; if (!File.Exists(Path.Combine(Directory.GetCurrentDirectory(), settingFile))) { SetCurrentDirectory(); } var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(settingFile, optional: false, reloadOnChange: true) .Build(); Settings = new AppSettingModel { APIURL = configuration.GetValue <string>("APIURL"), APIVendorId = configuration.GetValue <string>("APIVendorId"), Currency = configuration.GetValue <int>("Currency"), HangfireConnection = configuration.GetValue <string>("HangfireConnection"), BetDetailConnection = configuration.GetValue <string>("ConnectionStrings:BetDetailConnection"), ExcelFolder = configuration.GetValue <string>("ExcelFolder"), GMT = configuration.GetValue <int>("GMT") }; }
protected override void Establish_context() { base.Establish_context(); this._sessionTestModel = new SessionTestModel(1); this._appSettingModel = new AppSettingModel("The variable"); this._serverVariablesModel = new ServerVariablesModel(new System.Collections.Specialized.NameValueCollection()); }
public AccountHelper() { helper = new HtmlHelper(); Server = new ConnectServer(); appSetting = new AppSettingModel(); loginValue = ApplicationData.Current.LocalSettings; }
public DownLoadPictureView() { this.InitializeComponent(); TotalPage = 0; cts = new CancellationTokenSource(); appSetting = new AppSettingModel(); }
public ConnectServer() { appSetting = new AppSettingModel(); cookies = new CookieContainer(); handler = new HttpClientHandler(); handler.CookieContainer = cookies; }
public ListMessageView() { this.InitializeComponent(); helper = new HtmlHelper(); appSetting = new AppSettingModel(); messageController = new ListMessageController(); }
public SettingView() { this.InitializeComponent(); Helper = new HtmlHelper(); myLogin = new AccountHelper(); appSetting = new AppSettingModel(); }
public HtmlHelper() { Server = new ConnectServer(); appSetting = new AppSettingModel(); defineEmoticon = new DefineEmoticon(); EasClientDvInfo = new EasClientDeviceInformation(); GetTemplateHTML(); }
public BookmarkView() { this.InitializeComponent(); appSetting = new AppSettingModel(); GetListBookmark(); }
public ListMessageModelData(string Content) { doc = new HtmlDocument(); helper = new HtmlHelper(); appSetting = new AppSettingModel(); doc.LoadHtml(Content); }
public SharedAppSetting Convert(AppSettingModel sharedAppSettingModel) { return(_BuilderFactory .SharedAppSettingsBuilder() .WithKey(sharedAppSettingModel.Key) .WithValue(sharedAppSettingModel.Value) .Build()); }
/// <summary> /// 添加AddJwtBearer /// </summary> /// <param name="services"></param> /// <param name="appSetting">基本配置信息</param> public static void AddJwtBearer(this IServiceCollection services, AppSettingModel appSetting) { services.AddAuthorization(options => { options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().AddRequirements(new JwtBearerRequirement()).Build(); }); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(x => { x.RequireHttpsMetadata = true; x.SaveToken = true; x.TokenValidationParameters = new TokenValidationParameters { ValidateLifetime = true, //是否验证超时 当设置exp和nbf时有效 同时启用ClockSkew ValidateIssuer = true, //是否验证Issuer ValidateAudience = true, //是否验证Audience ValidateIssuerSigningKey = true, //是否验证SecurityKey ClockSkew = TimeSpan.FromMinutes(1), ValidIssuer = appSetting.Jwt.JwtIssuer, ValidAudience = appSetting.Jwt.JwtAudience, IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(appSetting.Jwt.JwtSecurityKey)), }; x.Events = new JwtBearerEvents() { OnAuthenticationFailed = async c => { c.NoResult(); c.Response.StatusCode = StatusCodes.Status200OK; c.Response.ContentType = "application/json; charset=utf-8"; if (c.Exception is SecurityTokenExpiredException) { await c.Response.WriteAsync(Other.JsonToString(new ResultHelp(HJSF.Enum.ResponseCode.NonLogin, "登录超时,请重新登录"))); } else { await c.Response.WriteAsync(Other.JsonToString(new ResultHelp(HJSF.Enum.ResponseCode.NonLogin, "信息验证失败,请重新登录"))); } }, OnForbidden = async c => { c.NoResult(); c.Response.StatusCode = StatusCodes.Status200OK; c.Response.ContentType = "application/json; charset=utf-8"; await c.Response.WriteAsync(Other.JsonToString(new ResultHelp(HJSF.Enum.ResponseCode.NonRole, "没有操作权限"))); }, OnChallenge = async c => { c.HandleResponse(); c.Response.StatusCode = StatusCodes.Status200OK; c.Response.ContentType = "application/json; charset=utf-8"; await c.Response.WriteAsync(Other.JsonToString(new ResultHelp(HJSF.Enum.ResponseCode.NonLogin, "未登录或者登录超时"))); } }; }); }
public AppSetting Convert(AppSettingModel appSettingModel) { return(_BuilderFactory .AppSettingBuilder() .WithKey(appSettingModel.Key) .WithValue(appSettingModel.Value) .WithTransformType(appSettingModel.TransformType) .Build()); }
public MessageView() { this.InitializeComponent(); helper = new HtmlHelper(); appSetting = new AppSettingModel(); messageController = new MessageController(); _instance = this; }
public ActionResult <string> GetName() { var model = new AppSettingModel { Name = "catcher from CoreRT" }; return(model.Name); //return _configuration.GetSection("Name").Value.ToString(); //return _model.Name; }
/// <summary> /// Find app settings. /// </summary> /// <returns></returns> private static AppSettingModel FindAppSettings() { var appSettingModel = new AppSettingModel(); appSettingModel.GoogleCaptchaSecret = ConfigurationManager.AppSettings[nameof(AppSettingModel.GoogleCaptchaSecret)]; appSettingModel.GoogleCaptchaValidationEndpoint = ConfigurationManager.AppSettings[nameof(AppSettingModel.GoogleCaptchaValidationEndpoint)]; return(appSettingModel); }
protected MongoDataProvider(IOptions <AppSettingModel> options) { var pack = new ConventionPack { new IgnoreExtraElementsConvention(true) }; ConventionRegistry.Register("My convention", pack, t => true); AppSetting = options.Value; }
public MessageModelData(string Content) { doc = new HtmlDocument(); helper = new HtmlHelper(); appSetting = new AppSettingModel(); doc.LoadHtml(Content); //helper.RemoveComment(doc); helper.AnalyzeURL(doc); helper.AnalyzeURLImage(doc); helper.AnalyzeContent(doc); }
/// <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() { appSetting = new AppSettingModel(); if (appSetting.ThemeSetting == "Light") { Application.Current.RequestedTheme = ApplicationTheme.Light; } else { appSetting.ThemeSetting = "Dark"; Application.Current.RequestedTheme = ApplicationTheme.Dark; } this.InitializeComponent(); DataAccess.InitializeDatabase(); }
public string SetAppSetting(AppSettingModel appSettingData) { try { var fileModels = new List <FileModel>(); if (appSettingData != null) { if (appSettingData.File != null) { fileModels = GetFileData(new List <IFormFile>() { appSettingData.File }, FileType.Image); } string imgData = appSettingData.Image; if (fileModels.Count > 0) { imgData = fileModels[0].DataBase64; } if (fileModels != null) { List <KeyValuePair <string, object> > param = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("@AppLogo", imgData.Replace(@"data:image/png;base64, ", "")), new KeyValuePair <string, object>("@AppName", appSettingData.AppName ?? "श्री आदित्य ज्योतिष केंद्र"), new KeyValuePair <string, object>("@UserId", appSettingData.UserId), new KeyValuePair <string, object>("@DefaultPassword", appSettingData.DefaultPassword), new KeyValuePair <string, object>("@ResetLinkValidity", appSettingData.ResetLinkValidity), new KeyValuePair <string, object>("@DefaultPasswordHash", EncryptManager.GetHashString(appSettingData.DefaultPassword)), }; return(DataExecutor.ExecuteScalar(UtilityConstant.Procedures.Mst_UpdateAppSetting, param)); } else { return(UtilityConstant.UserResponseStatus.NoDataFromClient); } } else { return(UtilityConstant.UserResponseStatus.NoDataFromClient); } } catch (Exception ex) { return(UtilityConstant.UserResponseStatus.Error); } }
public async Task SetPassword() { if (string.IsNullOrEmpty(PasswordToSet)) { return; } var settingModel = new AppSettingModel { AuthKey = SHA512.HashData(Encoding.UTF8.GetBytes(PasswordToSet)) }; await using var stream = File.OpenWrite("app.json"); await JsonSerializer.SerializeAsync(stream, settingModel); await JSRuntime.InvokeVoidAsync("location.reload"); }
/// <summary> /// Saves the specified item (create or update). /// </summary> /// <param name="item">The item.</param> /// <returns>Application setting.</returns> public AppSettingModel Save(AppSettingModel item) { var oldItem = SessionFactory <AppSetting> .Load(item.Name, false); if (oldItem == null) { SessionFactory <AppSetting> .Store(new AppSetting { Id = item.Name, Value = item.Value }); } else { oldItem.Value = item.Value; SessionFactory <AppSetting> .Store(oldItem); } return(item); }
public ActionResult GetAppSetting() { var appSettings = _appSettingService.Queryable().ToList(); if (!appSettings.Any()) { //var mainPath = @"C:\Crims\UserRecords"; var folderPath = "~/UserRecords"; var mainPath = Server.MapPath(folderPath); var newAppSeting = new AppSetting { Id = EntityIdGenerator.GenerateEntityId(), BiometricTemplatePath = folderPath }; if (!Directory.Exists(mainPath)) { Directory.CreateDirectory(mainPath); var dInfo = new DirectoryInfo(mainPath); var dSecurity = dInfo.GetAccessControl(); dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow)); dInfo.SetAccessControl(dSecurity); } _appSettingService.Insert(newAppSeting); _unitOfWork.SaveChanges(); return(Json(new AppSettingModel { Id = newAppSeting.Id, BiometricTemplatePath = newAppSeting.BiometricTemplatePath, SynchronisationTimeStr = "" }, JsonRequestBehavior.AllowGet)); } var appSetting = new AppSettingModel { Id = appSettings[0].Id, BiometricTemplatePath = appSettings[0].BiometricTemplatePath, SynchronisationTime = appSettings[0].SynchronisationTime, SynchronisationTimeStr = appSettings[0].SynchronisationTime.ToString("hh:mm"), SynchFrequency = appSettings[0].SynchFrequency, }; return(Json(appSetting, JsonRequestBehavior.AllowGet)); }
public ListThreadView() { this.InitializeComponent(); CurrentPage = 1; appBar.Width = ActualWidth; countRep = Resource.STR_EMPTY; helper = new HtmlHelper(); appSetting = new AppSettingModel(); listThreadController = new ListThreadController(); iconcolor = appSetting.ThemeSetting; new_thread.Visibility = Visibility.Collapsed; if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.FrameworkElement", "AllowFocusOnInteraction")) { page_btn_commandbar.AllowFocusOnInteraction = true; getIdthread.AllowFocusOnInteraction = true; jumpTextBox.AllowFocusOnInteraction = true; } _instance = this; }
public void Test_save() { using (RepositoryFactory.StartUnitOfWork()) { var action = RepositoryFactory.Action <IAppSettingAction>(); var item = action.Get(_setting1.Id); item.Value = "changed_value"; // try to update value using (var tran = RepositoryFactory.StartTransaction()) { action.Save(item); tran.Commit(); } var dbItem = action.Get(_setting1.Id); Assert.AreEqual(item.Name, dbItem.Name); Assert.AreEqual(item.Value, dbItem.Value); var newItem = new AppSettingModel { Name = "new_Value", Value = "changed_value" }; // try to update value using (var tran = RepositoryFactory.StartTransaction()) { action.Save(newItem); tran.Commit(); } dbItem = action.Get(newItem.Name); Assert.AreEqual(newItem.Name, dbItem.Name); Assert.AreEqual(newItem.Value, dbItem.Value); } }