private void mnuPositionAdd_Click(object sender, EventArgs e) { string name = FrmInput.GetInput("Geben Sie eine Bezeichnung ein:", "Bezeichnung eingeben", null, this); if (name != null) { foreach (ToolStripItem itemOther in mnuPositions.DropDownItems) { if (itemOther is ToolStripMenuItem) { if ((itemOther as ToolStripMenuItem).Checked) { (itemOther as ToolStripMenuItem).Checked = false; break; } } } ConfigPosition loc = new ConfigPosition(name, Left, Top); CurrentConfig.Positions.Add(loc); CurrentConfig.Save(); ToolStripMenuItem item = new ToolStripMenuItem(name); item.Click += mnuPositions_Click; item.Tag = loc; item.Checked = true; mnuPositions.DropDownItems.Add(item); mnuPositionSave.Tag = item; } }
private void FrmClock_Move(object sender, EventArgs e) { switch (CurrentStyle.HAlign) { case StringAlignment.Near: switch (CurrentStyle.VAlign) { case StringAlignment.Near: AnchorPoint = new Point(Left, Top); break; case StringAlignment.Center: AnchorPoint = new Point(Left, Top + Height / 2); break; case StringAlignment.Far: AnchorPoint = new Point(Left, Top + Height); break; } break; case StringAlignment.Center: switch (CurrentStyle.VAlign) { case StringAlignment.Near: AnchorPoint = new Point(Left + Width / 2, Top); break; case StringAlignment.Center: AnchorPoint = new Point(Left + Width / 2, Top + Height / 2); break; case StringAlignment.Far: AnchorPoint = new Point(Left + Width / 2, Top + Height); break; } break; case StringAlignment.Far: switch (CurrentStyle.VAlign) { case StringAlignment.Near: AnchorPoint = new Point(Left + Width, Top); break; case StringAlignment.Center: AnchorPoint = new Point(Left + Width, Top + Height / 2); break; case StringAlignment.Far: AnchorPoint = new Point(Left + Width, Top + Height); break; } break; } CurrentConfig.X = AnchorPoint.X; CurrentConfig.Y = AnchorPoint.Y; CurrentConfig.Save(); }
private async Task ApplyConfigAsync() { isApplying = true; var configNew = new ConfigViewModel(); if (!await configNew.ReadAsync(CurrentConfig.AssociatedDisk) || (configNew.CID != CurrentConfig.CID)) { SystemSounds.Hand.Play(); OperationStatus = "FlashAir seems changed."; return; } try { await CurrentConfig.WriteAsync(); SystemSounds.Asterisk.Play(); OperationStatus = "Applied new config."; } catch (Exception ex) { SystemSounds.Hand.Play(); OperationStatus = "Failed to apply new config."; Debug.WriteLine("Failed to apply new config. {0}", ex); } finally { isApplying = false; DelegateCommand.RaiseCanExecuteChanged(); } }
void uxBranchesTree_BeforeCheck(TreeView sender, TreeViewCancelEventArgs e) { if (e.Node.Checked) { return; } using (var tmpForm = new MergeTo(CurrentConfig.ListTfsBranches())) { tmpForm.ShowDialog(); if (tmpForm.Selected) { if (tmpForm.SelectedNode.Text != e.Node.Text) { var casted = (Branch)e.Node; casted.MergeTo = tmpForm.SelectedNode.Text; } else { e.Cancel = true; } } else { e.Cancel = true; } } }
internal override async Task BootstrapAsync(IClusterNode node) { try { //fetch the cluster map to avoid race condition with streaming http CurrentConfig = await _httpClusterMap.GetClusterMapAsync( Name, node.EndPoint, CancellationToken.None).ConfigureAwait(false); if (Context.ClusterOptions.HasNetworkResolution) { //Network resolution determined at the GCCCP level CurrentConfig.NetworkResolution = Context.ClusterOptions.EffectiveNetworkResolution; } else { //A non-GCCCP cluster CurrentConfig.SetEffectiveNetworkResolution(Context.ClusterOptions); } KeyMapper = _ketamaKeyMapperFactory.Create(CurrentConfig); node.Owner = this; await Context.ProcessClusterMapAsync(this, CurrentConfig).ConfigureAwait(false); } catch (CouchbaseException e) { Logger.LogDebug(LoggingEvents.BootstrapEvent, e, ""); throw; } //If we cannot bootstrap initially will loop and retry again. Bootstrapper.Start(this); }
private EventConfiguration GetEventConfigurationFromForm(int userId, CurrentConfig config) { var eventConfig = new EventConfiguration { PropertyId = config.PropertyId, PropertyOperator = config.PropertyOperator, PropertyValue = config.PropertyValue, Operator = config.Operator, ResultValue = Convert.ToInt32(config.ResultValue), Function = config.Function, Period = Convert.ToInt32(config.Period), UserId = userId, Template = config.Template, TemplateProperties = EventConfigurationHelper.ConvertTemplatePropertiesFromNamesToIds(config.TemplateProperties), Category = string.Empty, CategoryId = 0 }; if (!IsNewConfiguration(config.Id)) { eventConfig.Id = Convert.ToInt32(config.Id); } return(eventConfig); }
private void mnuStyles_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; ConfigStyle style = item.Tag as ConfigStyle; m_config.LastStyle = m_config.Styles.IndexOf(style); CurrentConfig = CurrentConfig; CurrentConfig.Save(); }
internal override async Task BootstrapAsync(IClusterNode node) { try { Logger.LogInformation("Bootstrapping: server negotiation started for {name}.", Redactor.UserData(Name)); if (Context.ClusterOptions.HasNetworkResolution) { //Network resolution determined at the GCCCP level #pragma warning disable CS8602 // Dereference of a possibly null reference. CurrentConfig.NetworkResolution = Context.ClusterOptions.EffectiveNetworkResolution; #pragma warning restore CS8602 // Dereference of a possibly null reference. } else { //A non-GCCCP cluster #pragma warning disable CS8602 // Dereference of a possibly null reference. CurrentConfig.SetEffectiveNetworkResolution(Context.ClusterOptions); #pragma warning restore CS8602 // Dereference of a possibly null reference. } if (SupportsCollections) { Manifest = await node.GetManifest().ConfigureAwait(false); } await node.HelloHello().ConfigureAwait(false); KeyMapper = _vBucketKeyMapperFactory.Create(CurrentConfig); Nodes.Add(node); await Context.ProcessClusterMapAsync(this, CurrentConfig).ConfigureAwait(false); var nodes = Context.GetNodes(Name); //update the local nodes collection lock (Nodes) { foreach (var clusterNode in nodes) { if (!Nodes.TryGet(clusterNode.EndPoint, out _)) { Nodes.Add(clusterNode); } } } ClearErrors(); Logger.LogInformation("Bootstrapping: server negotiation completed for {name}.", Redactor.UserData(Name)); } catch (Exception e) { if (e is CouchbaseException ce) { if (ce.Context is KeyValueErrorContext { Status : ResponseStatus.NotSupported })
//GET: AccountConfiguration/CurrentConfig public ActionResult CurrentConfig() { CurrentConfig config = _contextCurrent.GetCurrentConfig(); CurrentConfigurationViewModels viewModel = new CurrentConfigurationViewModels(config) { IncomeAccount = _contextGlAccount.GetIncomeAccount(), ExpenseAccount = _contextGlAccount.GetExpenseAccount(), PayableAccount = _contextGlAccount.GetPayableAccount() }; return(View(viewModel)); }
private void 新しい設定を作成ToolStripMenuItem_Click(object sender, EventArgs e) { var ncw = new NewConfigWindow(); ncw.SetLang(); if (ncw.ShowDialog() == DialogResult.OK) { var keyConfig = CurrentConfig.Clone(); keyConfig.Name = ncw.SettingName; AddKeyConfig(keyConfig); currentConfigIndex = keyConfigs.Count - 1; UncheckAllMenuItem(設定ToolStripMenuItem, 3); (this.設定ToolStripMenuItem.DropDownItems[3 + currentConfigIndex] as ToolStripMenuItem).Checked = true; ApplyConfigToDataGrid(CurrentConfig); } }
private void button2_Click(object sender, EventArgs e) { try { CurrentConfig.FilterUser = uxFilter.Checked; CurrentConfig.FilterEsightDev = uxFilterDevChanges.Checked; CurrentConfig.SaveBranches(uxBranchesTree.Nodes, DbSession); StartMergeMonitor(); MessageBox.Show(Resources.SavedMessage); Hide(); } catch (Exception ex) { MessageBox.Show(Resources.ErrorWhileSaving + ex.Message); } }
private void m_Engine_EndSelect() { // switch which was repeat selecting released. Ensure no repeats (although trigger shouldn't be called anyway!) if (m_RepeatItem?.HasRepeatingScript ?? false) { // custom repeating scripts, this would usually stop // but first check if this actually ends, or if they are in the alternate mode: if (CurrentConfig.ReadBoolean(Config.Repeat_PressStop)) { return; // this doesn't actually stop until clicked again. The switch up does nothing } StopCustomRepeat(); } else { m_RepeatItem = null; } }
public static void DisplayCurrentConfigSection(CurrentConfig currentConfig) { Console.WriteLine("Current config:"); Console.CursorLeft += Indent; Console.WriteLine(currentConfig.Config.FilePath); string database = string.Format("{0} ({1})", currentConfig.Config.ConnectionString.Database, currentConfig.Config.ConnectionString.Server); WriteProperty("Database", database, Indent); if (currentConfig.Config.ApiUrl != null) { WriteProperty("Api URL", currentConfig.Config.ApiUrl.ToString(), Indent); } WriteHorizontalLine(); }
public static void SetConfig(string configPath) { _config = new CurrentConfig(GetConfig.UseJsonFile(configPath) .UseTypeParser(new DictionaryParser()) .Build()); Site = _config.Site; Browser = _config.Browser; Pages = _config.Pages; if (_config.Login == null) { return; } Login = _config.Login; }
private void mnuPositionSave_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; if (item.Tag == null) { return; } ToolStripMenuItem posItem = item.Tag as ToolStripMenuItem; ConfigPosition pos = posItem.Tag as ConfigPosition; pos.X = Left; pos.Y = Top; CurrentConfig.Save(); }
/// <summary> /// Reset configuration to default settings. The old configuration is stored to 'user.config.tmp'. /// This is done by deleting the configuration file. /// </summary> /// <returns></returns> public string Reset() { // .net standard configuration file string filePath = CurrentConfig.FilePath; CurrentConfig.SaveAs($@"{filePath}.tmp", ConfigurationSaveMode.Full, forceSaveAll: true); File.Delete(filePath); // Settings.json string fileSource = Path.Combine(Path.GetDirectoryName(filePath), "Settings.json"); string fileTarget = Path.Combine(Path.GetDirectoryName(filePath), "Settings.json.tmp"); File.Copy(fileSource, fileTarget, true); File.Delete(fileSource); return(filePath); }
private async ValueTask <bool> ProcessPacket(Packet packet, CancellationToken transferToken) { var continueProcessing = true; switch (packet) { case EOSPacket eosPacket: await PushEosPacket(eosPacket, transferToken); continueProcessing = false; break; case BufferConfigurationPacket bufferConfigPacket: CurrentConfig = bufferConfigPacket; if (CurrentConfig.StreamType == StreamType.Audio && !CurrentConfig.Compatible(bufferConfigPacket)) { logger.Warn($"{streamType}: Incompatible Stream config change."); streamReconfigureSubject.OnNext(Unit.Default); // exit transfer task. This will prevent further transfers // Stops/Restarts will be called by reconfiguration handler. continueProcessing = false; } break; case EncryptedPacket encryptedPacket: await PushEncryptedPacket(encryptedPacket, transferToken); currentPts = packet.Pts; break; case Packet dataPacket: await PushUnencryptedPacket(dataPacket, transferToken); currentPts = packet.Pts; break; default: throw new ArgumentException($"{streamType}: Unsupported packet type {packet.GetType()}"); } return(continueProcessing); }
public CurrentConfigurationViewModels(CurrentConfig config) { if (config == null) { Id = 0; } else { Id = config.Id; CreditInterestRate = config.CreditInterestRate; MinBalance = config.MinBalance; ExpenseGlAccountId = config.ExpenseGlAccountId; CommissionOnTurnover = config.CommissionOnTurnover; CotGlAccount = config.CotGlAccount; IncomeGlAccountId = config.IncomeGlAccountId; CurrentInterestPayableGlId = config.CurrentInterestPayableGlId; } }
public void ValidateEntity() { try { if (!CurrentConfig.Equals(ConfigRouteEntity)) { if (MessageBoxService.ShowMessage("Hay cambios pendientes, ¿Desea guardarlos?", "Cambios sin guardar", MessageButton.YesNo) == MessageResult.Yes) { UpdateConfigCheckList(); } } } catch (Exception ex) { MessageBoxService.ShowMessage(GetStringValue(Next.Enums.Enums.MessageError.DataError) + ex.Message, ex.Message, MessageButton.OK, MessageIcon.Error); } }
public void SetNumber(int num, bool keybord) { if (waitinginput && this.dataGridView1.CurrentRow != null) { int index = this.dataGridView1.CurrentRow.Index; if (keybord) { this.dataGridView1.CurrentRow.Cells[0].Value = num.ToString(); CurrentConfig.SetKeyMap(ButtonUtility.Array[index], num); } else { this.dataGridView1.CurrentRow.Cells[1].Value = num.ToString(); CurrentConfig.SetButtonMap(ButtonUtility.Array[index], num); } waitinginput = false; this.label1.Visible = false; } }
public string GenerateConfigFile() { //return String.Format( // "{1} 1 {6} 1 NDIM,IPS,IRS,ILP {0}" + // "1 0 NICP,(ICP(I),I=1 NICP) {0}" + // "15 4 3 1 1 0 0 0 NTST,NCOL,IAD,ISP,ISW,IPLT,NBC,NINT {0}" + // "{5} {2} {3} 0 10000 NMX,RL0,RL1,A0,A1 {0}" + // "50 100 0 8 5 3 0 NPR,MXBF,IID,ITMX,ITNW,NWTN,JAC {0}" + // "1e-008 1e-008 1e-006 EPSL,EPSU,EPSS {0}" + // "{4}0.001 1e-005 0.1 1 DS,DSMIN,DSMAX,IADS{0}" + // "0 NTHL,(/,I,THL(I)),I=1,NTHL) {0}" + // "0 NTHU,(/,I,THU(I)),I=1,NTHU) {0}" + // "0 NUZR,(/,I,PAR(I)),I=1,NUZR){0}{0}{0}", // Environment.NewLine, NumVariables, StartValue, EndValue, (Direction ? "" : "-"), MaxNumSteps, // (Label.HasValue ? Label.Value : 0) // ); ApplySettingsToCurrentConfig(); return(CurrentConfig.ToInputString()); }
public CurrentConfig GetByCurrentConfigBranch(int id) { CurrentConfig currentConfigs = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri(LocalhostAddress); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // HTTP GET HttpResponseMessage response = client.GetAsync("api/Currentconfig/GetByBranch/?id=" + id).Result; if (response.IsSuccessStatusCode) { currentConfigs = response.Content.ReadAsAsync <CurrentConfig>().Result; return(currentConfigs); } else { string message = response.ReasonPhrase; } } return(currentConfigs); }
private async Task ApplyConfigAsync() { try { _isApplying = true; var configNew = new ConfigViewModel(); if (!await configNew.ReadAsync(CurrentConfig.AssociatedDisk) || (configNew.CID != CurrentConfig.CID)) { SystemSounds.Hand.Play(); OperationStatus = Resources.OperationStatus_Changed; return; } try { await CurrentConfig.WriteAsync(); SystemSounds.Asterisk.Play(); OperationStatus = Resources.OperationStatus_Applied; } catch (Exception ex) { SystemSounds.Hand.Play(); OperationStatus = Resources.OperationStatus_Failed; Debug.WriteLine($"Failed to apply new config.\r\n{ex}"); } } finally { _isApplying = false; DelegateCommand.RaiseCanExecuteChanged(); } }
public void UpdateCurrentConfig(CurrentConfig config) { _current.Update(config); }
public ActionResult CurrentConfig(CurrentConfig save) { bool status = false; CurrentConfig config = _contextCurrent.GetCurrentConfig(); CurrentConfigurationViewModels viewModel = new CurrentConfigurationViewModels(config) { IncomeAccount = _contextGlAccount.GetIncomeAccount(), ExpenseAccount = _contextGlAccount.GetExpenseAccount() }; var interest = Request.Form["Interest"]; var balance = Request.Form["Balance"]; var expenseAcct = Request.Form["Expense"]; var cot = Request.Form["Cot"]; var incomeAcct = Request.Form["Income"]; var payable = Request.Form["Payable"]; save.CreditInterestRate = Math.Round(Convert.ToDecimal(Request.Form["Interest"], CultureInfo.InvariantCulture), 4); save.MinBalance = Math.Round(Convert.ToDecimal(Request.Form["Balance"], CultureInfo.InvariantCulture), 4); save.CommissionOnTurnover = Math.Round(Convert.ToDecimal(Request.Form["Cot"], CultureInfo.InvariantCulture), 4); save.ExpenseGlAccountId = Convert.ToInt32(Request.Form["Expense"]); save.IncomeGlAccountId = Convert.ToInt32(Request.Form["Income"]); save.CurrentInterestPayableGlId = Convert.ToInt32(Request.Form["Payable"]); save.Id = Convert.ToInt32(Request.Form["Id"]); if (save.Id == 0) { save.status = true; _logic.SaveCurrentConfig(save); TempData["Message"] = "Configurations Added"; status = true; } else { var configInDb = _logic.GetCurrent(save.Id); configInDb.CreditInterestRate = Math.Round(Convert.ToDecimal(interest, CultureInfo.InvariantCulture), 4); configInDb.MinBalance = Math.Round(Convert.ToDecimal(balance, CultureInfo.InvariantCulture), 4); configInDb.ExpenseGlAccountId = Convert.ToInt32(expenseAcct); configInDb.CommissionOnTurnover = Math.Round(Convert.ToDecimal(cot, CultureInfo.InvariantCulture), 4); configInDb.IncomeGlAccountId = Convert.ToInt32(incomeAcct); configInDb.CurrentInterestPayableGlId = Convert.ToInt32(payable); if (interest == null || balance == null || expenseAcct == null) { configInDb.status = false; } configInDb.status = true; _logic.UpdateCurrentConfig(save); TempData["Message"] = "New Configurations Added"; status = true; } ViewBag.Status = status; return(RedirectToAction("CurrentConfig", "AccountConfiguration")); }
private void m_Engine_Trigger(bool isRepeat) { if (m_frmReport != null) { m_frmReport.SwitchActivated(); return; } if (m_RepeatItem?.HasRepeatingScript ?? false) { // currently doing custom repeats scripts if (CurrentConfig.ReadBoolean(Config.Repeat_PressStop) && !isRepeat) { StopCustomRepeat(); } // either way no further action is taken on this - the separate timer activates this return; } if (m_Continuous != null) { // a command has captured the output to make a selection if (!m_Continuous.Trigger(isRepeat)) { m_Continuous?.Stop(); // ? needed in case the command removed itself already m_Continuous = null; } return; } var item = isRepeat ? m_RepeatItem : m_Current; if (item == null) // usually this will be because repeating is not enabled on the last item, but also covers the case where nothing was selected for a genuine switch activation { return; } if (CurrentConfig.ReadBoolean(Config.Use_Swap_Switch)) { LogicalSwapper.Swap = !LogicalSwapper.Swap && !item.ResetSwap; } // if item has ResetSwap then the state is forced to false // when repeating we explicitly use the remembered item -it may have selected something else as "current" //Debug.WriteLine("Trigger"); var current = m_Current; if (isRepeat && item.HasRepeatingScript) { InvokeScript(item, Scriptable.ScriptTypes.Repeat, true, item); } else { InvokeScript(m_Current, Scriptable.ScriptTypes.Select); } if (!isRepeat) // for first activation, set up repeating if needed. { // if item is not AutoRepeat, failing to set this will ensure the repeat triggers are ignored if (current.HasRepeatingScript) { // start up the timer for custom repeat scripts m_RepeatItem = current; InvokeScript(m_RepeatItem, Scriptable.ScriptTypes.PreRepeat, true, m_RepeatItem); // this one fires immediately. m_RepeatTimer.Interval = m_Engine.ConfiguredTiming(Switches.Engine.Timings.FirstRepeat); m_RepeatTimer.Enabled = true; } else if (current.AutoRepeat) { m_RepeatItem = current; } } }
public ColNetManager(CurrentConfig cConfig = null) { Init(cConfig.DbConnectionString); IdGroup = cConfig.IdGroup; }
public void SaveCurrentConfig(CurrentConfig config) { //Saving into the database _current.Add(config); _current.Save(config); }
protected ILHDBTran BeginTran() { return(CurrentConfig.BeginTran()); }
public AppContext(string definedConfigsPath, string currentConfigPath, string configFileName) { _definedConfigs = new DefinedConfigs(definedConfigsPath, configFileName); _currentConfig = new CurrentConfig(currentConfigPath); InitializeState(); }