public ActionResult Save() { if (!IsUserizedRequest) { return(AccessDeniedView()); } var settings = GetSettings()(); var editableSettingsModel = settings.ToEditableSettingsModel <TSettings, TEditableSettingsModel>(); InjectModelDependencies(editableSettingsModel); return(View(editableSettingsModel)); }
protected void Page_Init(object sender, EventArgs e) { // Do any related intialization work. GetSettings settings = new GetSettings(); hfResultFolder.Value = settings.GetResultPath(Server.MapPath("~")); }
public SettingsViewModel() { var metaLocation = AppDomain.CurrentDomain.BaseDirectory; var globalIniLocation = Path.Combine(metaLocation, Settings.Default.GlobalIniLocation); var globalIniFile = File.ReadAllText(globalIniLocation); GlobalIniText = new TextDocument { Text = globalIniFile != "" ? globalIniFile : "" }; GameLocation = GetSettings.Return(SettingTypes.GameLocation); if (GameLocation != "") { return; } var regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Bethesda Softworks\Skyrim"); if (regKey != null) { var value = (string)regKey.GetValue("Installed Path"); GameLocation = value; } Model.SaveSettings.Save(SettingTypes.GameLocation, GameLocation); }
public ScannerSettings GetScannerSettings() { Log("Get scanner settings"); var getSettings = new GetSettings(GetTwainScannerSettings); var settings = _windowsMessageLoop.Invoke <SourceSettings>(getSettings); Dictionary <int, string> supportedScanSources = null; if (settings.HasADF && settings.HasFlatbed) { supportedScanSources = new Dictionary <int, string> { { (int)ScanFeed.Flatbad, EnumExtensions.GetDescription(ScanFeed.Flatbad) }, { (int)ScanFeed.Feeder, EnumExtensions.GetDescription(ScanFeed.Feeder) } }; if (settings.HasDuplex) { supportedScanSources.Add((int)ScanFeed.Duplex, EnumExtensions.GetDescription(ScanFeed.Duplex)); } } var scannerSettings = new ScannerSettings(Index, Name, settings.FlatbedResolutions, settings.FeederResolutions, TwainPixelTypeExtensions.GetSelectListDictionary(settings.PixelTypes), settings.PhysicalHeight, settings.PhysicalWidth, supportedScanSources); Log("Get scanner settings success"); return(scannerSettings); }
/// <summary> /// Function for update the approve status of comments. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ApproveSelectedComment(object sender, EventArgs e) { if (Pub.Any()) { foreach (GridViewRow row in GridComments.Rows) { // Access the CheckBox CheckBox cb = (CheckBox)row.FindControl("chkPublish"); if (cb != null && cb.Checked && !Pub[row.DataItemIndex].Approved) { Pub[row.DataItemIndex].Approved = true; _objRepository.Update(Pub[row.DataItemIndex]); string userEmail = Pub[row.DataItemIndex].Email; Database context = Sitecore.Context.ContentDatabase; GetSettings getSettings = new GetSettings(); var settingsValue = getSettings.GetSetting(Result, context); if (settingsValue.UserEmail && !string.IsNullOrEmpty(settingsValue.FromEmail) && !string.IsNullOrEmpty(userEmail) && !string.IsNullOrEmpty(settingsValue.UserMsgSubject) && !string.IsNullOrEmpty(settingsValue.UserMsgBody)) { Utility.SendMail(settingsValue.FromEmail, userEmail, settingsValue.UserMsgSubject, settingsValue.UserMsgBody); } } else if (cb != null && !cb.Checked && Pub[row.DataItemIndex].Approved) { Pub[row.DataItemIndex].Approved = false; _objRepository.Update(Pub[row.DataItemIndex]); } } } }
/// <summary> /// OnSettingsLoaded gets called BEFORE OnLoad!!! /// So, oyu need to load the settings here?? Why isn't GetSettings called on it's own? It's an event handler? /// One would think that by the time OnSettingsLoaded is called, GetSettings was already called! /// </summary> protected override void OnSettingsLoaded() { base.OnSettingsLoaded(); try { GetSettings?.Invoke(this, EventArgs.Empty); txtHistory.Text = Model.Settings.History.ToDnnString(); txtDescriptionLength.Text = Model.Settings.DescriptionLength.ToDnnString(); txtEditorHeight.Text = Model.Settings.EditorHeight.ToDnnString(); foreach (Enum i in Enum.GetValues(typeof(ViewTypes))) { try { ddlViewType.Items.Add(new ListItem( Localization.GetString(Enum.GetName(typeof(ViewTypes), i), LocalResourceFile), Enum.GetName(typeof(ViewTypes), i))); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, new Exception("inloop", ex)); } } ddlViewType.SelectedValue = Model.Settings == null?ViewTypes.Current.ToString() : Utilities.ViewTypeToString(Model.Settings.DefaultViewType); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnStart(string[] args) { string currentPath; if (args.Length > 0) { currentPath = args[0]; } else { currentPath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]); } LogMessages.LogFilePath = Path.Combine(currentPath, "LogMessages.txt"); LogMessages.Log("Служба запущена."); MessageShowMethod.ShowMethod = LogMessages.Log; Settings = new GetSettings(currentPath); Settings.ReadSettingsFile(); if (Settings.IsActual) { LogMessages.Log("Интервал всего цикла в настройках: " + Settings.IntervalAllCile); MainTimer = new Timer(StartCopy, null, 0, Settings.IntervalAllCile * 1000); } else { LogMessages.Log("Настройки не приняты - запущена остановка службы."); this.Stop(); } }
protected void Page_Load(object sender, EventArgs e) { GetSettings settings = new GetSettings(); dir = settings.GetResultPath(Server.MapPath("~")); showContent(); }
private void ClosePresetDialog(object sender, DialogClosingEventArgs eventargs) { // Close the dialog unless more commands are needed. if ((bool)eventargs.Parameter == false) { return; } if (PresetName == null) { return; } if (GetSettings.Return(SettingTypes.GameLocation) == "") { return; } PresetManager.SavePreset(PresetName, PresetDescription, UsingGlobalIni); Presets = new ObservableCollection <PresetData>(PresetManager.GetPresets()); PresetName = null; PresetDescription = null; IsHintVisible = Presets.Count <= 0; }
public ActionResult NewComment(CommentAttributes commentAttributes) { // Get item url var itmUrl = new UriBuilder(LinkManager.GetItemUrl(Context.Database.GetItem(commentAttributes.BlogPostId), new UrlOptions { AlwaysIncludeServerUrl = true })); BlogpostId = commentAttributes.BlogPostId; Recaptcha recaptcha = new Recaptcha(); GetSettings objGetSettings = new GetSettings(); var setting = objGetSettings.GetSetting(BlogpostId); commentAttributes.CaptchaResponse = Request["g-recaptcha-response"]; try { Comment cmt = new Comment { PostId = commentAttributes.BlogPostId, Author = commentAttributes.AuthorName, Email = commentAttributes.AuthorEmail, Date = DateTime.Now, Body = commentAttributes.AuthorComment }; if (setting.SiteKey.IsNullOrEmpty()) { // Insert comment in comment in mongodb database. _objRepository.Insert(cmt); SendMailToAdmin(BlogpostId); var uri = AddQuery(itmUrl, "status", "success"); Response.Redirect(uri.ToString()); } if (!setting.SiteKey.IsNullOrEmpty()) { if (recaptcha.Validate(commentAttributes.CaptchaResponse, BlogpostId)) { // Insert comment in comment in mongodb database. _objRepository.Insert(cmt); SendMailToAdmin(BlogpostId); var uri = AddQuery(itmUrl, "status", "success"); Response.Redirect(uri.ToString()); } else { Log.Error("Captcha not filled", this); var errorUri = AddQuery(itmUrl, "status", "captchaerror"); Response.Redirect(errorUri.ToString()); } } } catch (Exception ex) { Log.Error(ex.Message, this); var errorUri = AddQuery(itmUrl, "status", "error"); Response.Redirect(errorUri.ToString()); } return(Json("ok", JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { GetSettings settings = new GetSettings(); fileName = settings.GetConfigFilePath(Server.MapPath("~")); InitBaseValues(); ReadConfigData(settings.GetConfigFilePath(Server.MapPath("~"))); }
protected void Page_Load(object sender, EventArgs e) { GetSettings settings = new GetSettings(); dir = settings.GetResultPath(Server.MapPath("~")); isBeingExecuted = BatFileProcessor.TestsBeingExecuted(); showContent(); }
public void OpenGameDirectory(object o) { var gameDirectory = GetSettings.Return(SettingTypes.GameLocation); if (gameDirectory != "") { Process.Start(gameDirectory); } }
private static string getLogsDirectory() { if (_logsDirectory != null) { return(_logsDirectory); } _logsDirectory = GetSettings.GetValuesFromXml("ExternalResources.xml", "LogsDirectory"); return(_logsDirectory); }
public void SendMailToAdmin(string blogpostid) { GetSettings getSettings = new GetSettings(); var settingsValue = getSettings.GetSetting(blogpostid); if (settingsValue.AdminEmail && !string.IsNullOrEmpty(settingsValue.FromEmail) && !string.IsNullOrEmpty(settingsValue.ToEmail) && !string.IsNullOrEmpty(settingsValue.AdminMsgSubject) && !string.IsNullOrEmpty(settingsValue.AdminMsgBody)) { Utility.SendMail(settingsValue.FromEmail, settingsValue.ToEmail, settingsValue.AdminMsgSubject, settingsValue.AdminMsgBody); } }
public ActionResult Save(TEditableSettingsModel editableSettingsModel, bool continueEditing) { if (!IsUserizedRequest) { return(AccessDeniedView()); } if (!ModelState.IsValid) { InjectModelDependencies(editableSettingsModel); return(View(editableSettingsModel)); } var settings = GetSettings()(); settings = editableSettingsModel.ToSettings(settings); var operationResult = SaveSettingsAndReturnOperationResult(settings)(); if (!operationResult.Success) { ModelState.InjectMessages(operationResult); ResourceErrorNotification(CommonConstants.Systematic.NotSaved); InjectModelDependencies(editableSettingsModel); return(View(editableSettingsModel)); } ResourceSuccessNotification(CommonConstants.Systematic.Saved); if (continueEditing) { return(RedirectToAction(KnownActionNames.Save)); } return(RedirectToRoute(SettingsSectionConstants.RouteName)); }
public ActionResult ReplyComment(ReplyCommentAttributes commentAttributes) { BlogpostId = commentAttributes.CurrentItem; Recaptcha recaptcha = new Recaptcha(); GetSettings objGetSettings = new GetSettings(); var setting = objGetSettings.GetSetting(BlogpostId); try { Comment cmt = new Comment { PostId = commentAttributes.CurrentItem, CommentId = Guid.NewGuid().ToString(), ParentId = commentAttributes.hfParentCommentId, Author = commentAttributes.Name, Email = commentAttributes.Email, Date = DateTime.Now, Body = commentAttributes.Comment }; if (setting.SiteKey.IsNullOrEmpty()) { // Insert comment in comment in mongodb database. _objRepository.Insert(cmt); SendMailToAdmin(BlogpostId); return(Json("success", JsonRequestBehavior.AllowGet)); } if (!setting.SiteKey.IsNullOrEmpty()) { if (recaptcha.Validate(commentAttributes.captchaResponse, BlogpostId)) { // Insert comment in comment in mongodb database. _objRepository.Insert(cmt); SendMailToAdmin(BlogpostId); return(Json("success", JsonRequestBehavior.AllowGet)); } else { Log.Error("Captcha not filled", this); return(Json("captchaerror", JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { Log.Error(ex.Message, this); return(Json("error", JsonRequestBehavior.AllowGet)); } return(Json("ok", JsonRequestBehavior.AllowGet)); }
private void InstallPreset(object o) { if ((string)o == GetSettings.Return(SettingTypes.InstalledPreset)) { PresetManager.CleanGameDirectory(); SaveSettings.Save(SettingTypes.InstalledPreset, ""); } else { PresetManager.InstallPreset((string)o); } Presets = new ObservableCollection <PresetData>(PresetManager.GetPresets()); }
static void Saving() { DialogResult loadBoxResult = MessageBox.Show("Do you want to save your progress?", "Saving.", MessageBoxButtons.OKCancel, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Console.Clear(); if (loadBoxResult == DialogResult.OK) { GetSettings.Save(); Console.WriteLine("Saved!"); } else { Console.WriteLine("Resuming without saving"); } }
// Get the game settings public GetSettingsResponse Get(GetSettings request) { var settings = Db.Select<Setting>().ToDictionary(s => new KeyValuePair<string, string>(s.Name, s.Value)); return new GetSettingsResponse { BaseballYear = settings.ContainsKey("BaseballYear") ? Convert.ToInt32(settings["BaseballYear"]) : DateTime.UtcNow.Month < 5 ? DateTime.UtcNow.Year - 1 : DateTime.UtcNow.Year, RegistrationOpen = settings.ContainsKey("RegistrationOpen") ? Convert.ToBoolean(settings["RegistrationOpen"]) : DateTime.UtcNow.Month > 2 && DateTime.UtcNow.Month < 5, PasswordProtected = settings.ContainsKey("RegistrationPassword") && settings["RegistrationPassword"].Length > 0 }; }
public void refresh_items() { GetSettings get_settings = new GetSettings(General.settings.username, General.settings.password, General.settings.host, General.settings.lang); string data = get_settings.execute(); General.user = new JavaScriptSerializer().DeserializeObject(data) as IDictionary <string, object>; SMSHeaders SH = new SMSHeaders(General.settings.username, General.settings.password, General.settings.host, General.settings.lang); string data1 = SH.execute(); General.headers = new JavaScriptSerializer().Deserialize <IList <string> >(data1); if (General.user != null) { fullname_lbl.Text = General.user["fullname"].ToString(); username_lbl.Text = General.user["username"].ToString(); total_waiting_lbl.Text = General.user["waiting_all"].ToString(); total_delivered_lbl.Text = General.user["delivered_all"].ToString(); total_undelivered_lbl.Text = General.user["undelivered_all"].ToString(); total_count_lbl.Text = General.user["count_all"].ToString(); pkt_balance_tsslbl.Text = string.Format("{0} SMS, {1} TELEFON", General.user["sms_balance_pkt"].ToString(), General.user["tel_balance_pkt"].ToString()); balance_tsslbl.Text = string.Format("{0} {1} BAKİYE", General.user["balance"].ToString(), General.user["currency"].ToString()); try { var Pbox = new PictureBox(); Pbox.Load(string.Format("http://{0}/media/profile_pictures/{1}.jpg", General.settings.host, General.user["username"].ToString())); picture_pnl.BackgroundImage = Pbox.Image; } catch { } sms_header_cmbbx.DataSource = General.headers; } message_rchtxtbx.Text = phoneset_rchtxtbx.Text = ""; mainform_sttsstrp.BackColor = SystemColors.Highlight; this.phoneset_rchtxtbx.ReadOnly = false; ready_tsslbl.Text = "Ready"; this.Is_SMSCustom = false; this.ExcelFileName = ""; this.ExcelPhoneColumn = 0; this.GSM_Array = null; this.message_auto_complete_menu.RemoveItems(); }
private void login_btn_Click(object sender, EventArgs e) { General.settings.username = username_txtbx.Text.Trim(); General.settings.password = password_txtbx.Text; GetSettings get_settings = new GetSettings(General.settings.username, General.settings.password, General.settings.host, General.settings.lang); string data = get_settings.execute(); if (get_settings.Is_Passed) { AllowEnter = true; General.user = new JavaScriptSerializer().DeserializeObject(data) as IDictionary <string, object>; SMSHeaders SH = new SMSHeaders(General.settings.username, General.settings.password, General.settings.host, General.settings.lang); string data1 = SH.execute(); General.headers = new JavaScriptSerializer().Deserialize <IList <string> >(data1); //Console.WriteLine(General.headers); this.Close(); } else { MessageBox.Show("Kullanıcı adı veya Şifre hata!", data, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Carga y configuración del grid GiftsProdGifts /// </summary> /// <param name="blnOnlyOneRegister"></param> /// <param name="blnGiftsProdGift"></param> /// <param name="blnAllGiftsProdGift"></param> /// <history> /// [vku] 25/May/2016 Created /// </history> private async void LoadGiftsProdGift(bool blnOnlyOneRegister, bool blnGiftProdGift, bool blnAllGiftsProdGift) { if (!blnGiftProdGift) { return; } grdGiftsProdGift.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended; pnlGiftsProdGift.Visibility = Visibility.Visible; List <string> _prodByGift = GetSettings.ProductionByGift(); _lstGiftsProdGift = await BRGifts.GetGiftsShortById(_prodByGift); grdGiftsProdGift.ItemsSource = _lstGiftsProdGift; chkAllGiftsProdGift.IsChecked = blnAllGiftsProdGift; chkAllGiftsProdGift.IsEnabled = !blnOnlyOneRegister; if (!frmPO._clsFilter._lstGiftsProdGift.Any()) { return; } chkAllGiftsProdGift.IsChecked = (grdGiftsProdGift.SelectionMode == DataGridSelectionMode.Extended) && frmPO._clsFilter.AllGiftsProdGift; if (grdGiftsProdGift.ItemsSource != null && !frmPO._clsFilter.AllGiftsProdGift && !blnOnlyOneRegister) { grdGiftsProdGift.SelectedItem = null; frmPO._clsFilter._lstGiftsProdGift.ForEach(c => { grdGiftsProdGift.SelectedItems.Add(_lstGiftsProdGift.FirstOrDefault(g => g.giID == c)); }); } else { grdGiftsProdGift.SelectedItem = _lstGiftsProdGift.FirstOrDefault(c => c.giID == frmPO._clsFilter._lstGiftsProdGift[0]); } }
/// <summary> /// Carga y configuración del grid LeadSourcesPaymentCoom /// </summary> /// <param name="blnOnlyOneRegister"></param> /// <param name="blnLeadSourcesPaymentComm"></param> /// <param name="blnAllLeadSourcesPaymentComm"></param> /// <history> /// [vku] 25/May/2016 Created /// </history> private void LoadLeadSourcesPaymentCoom(bool blnOnlyOneRegister, bool blnLeadSourcesPaymentComm, bool blnAllLeadSourcesPaymentComm) { if (!blnLeadSourcesPaymentComm) { return; } grdLeadSourcesPaymentComm.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended; pnlLeadSourcesPaymentComm.Visibility = Visibility.Visible; List <string> _paymentComm = GetSettings.PRPaymentCommissions(); _lstLeadSourcesPaymentComm = BRLeadSources.GetLeadSourceById(_paymentComm); grdLeadSourcesPaymentComm.ItemsSource = _lstLeadSourcesPaymentComm; chkAllLeadSourcesPaymentComm.IsChecked = blnAllLeadSourcesPaymentComm; chkAllLeadSourcesPaymentComm.IsEnabled = !blnOnlyOneRegister; if (!frmPO._clsFilter._lstLeadSourcesPaymentComm.Any()) { return; } chkAllLeadSourcesPaymentComm.IsChecked = (grdLeadSourcesPaymentComm.SelectionMode == DataGridSelectionMode.Extended) && frmPO._clsFilter.AllLeadSourcesPaymentComm; if (grdLeadSourcesPaymentComm.ItemsSource != null && !frmPO._clsFilter.AllLeadSourcesPaymentComm && !blnOnlyOneRegister) { grdLeadSourcesPaymentComm.SelectedItem = null; frmPO._clsFilter._lstLeadSourcesPaymentComm.ForEach(c => { grdLeadSourcesPaymentComm.SelectedItems.Add(_lstLeadSourcesPaymentComm.FirstOrDefault(l => l.lsID == c)); }); } else { grdLeadSourcesPaymentComm.SelectedItem = _lstLeadSourcesPaymentComm.FirstOrDefault(c => c.lsID == frmPO._clsFilter._lstLeadSourcesPaymentComm[0]); } }
public ScannerSettings GetScannerSettings() { Log("Get scanner settings"); var getSettings = new GetSettings(GetTwainScannerSettings); var settings = _windowsMessageLoop.Invoke<SourceSettings>(getSettings); Dictionary<int, string> supportedScanSources = null; if (settings.HasADF && settings.HasFlatbed) { supportedScanSources = new Dictionary<int, string> { {(int)ScanFeed.Flatbad, EnumExtensions.GetDescription(ScanFeed.Flatbad)}, {(int)ScanFeed.Feeder, EnumExtensions.GetDescription(ScanFeed.Feeder)} }; if (settings.HasDuplex) { supportedScanSources.Add((int)ScanFeed.Duplex, EnumExtensions.GetDescription(ScanFeed.Duplex)); } } var scannerSettings = new ScannerSettings(Index, Name, settings.FlatbedResolutions, settings.FeederResolutions, TwainPixelTypeExtensions.GetSelectListDictionary(settings.PixelTypes), settings.PhysicalHeight, settings.PhysicalWidth, supportedScanSources); Log("Get scanner settings success"); return scannerSettings; }
public IActionResult Index() { var model = GetSettings.GetModel(ViewBag); return(View(model)); }
public void Settings() { GetSettings.ToForm(); GetSettings.Save(); }
=> _appModule = new AppModule(GetSettings(config));
public void GetCredentials() { var settings = GetSettings.GetDevSettings(); var pinAuthenticator = new PinAuthenticator(settings); var creds = pinAuthenticator.GetTwitterCredentials(); }