private void CmdOk_Click(object sender, EventArgs e) { if (!this.MapViewToModel()) { return; } try { Cursor.Current = Cursors.WaitCursor; EmotionModule.Save(this.Module); // Add the decoder into the project if (!OTCContext.Project.EasyConnectEmotionModules.Contains(this.Module)) { OTCContext.Project.EasyConnectEmotionModules.Add(this.Module); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } }
} //+ : 怒り - : 逃げ void Awake() { _rigidbody = GetComponent <Rigidbody2D>(); _collider = GetComponent <Collider2D>(); DefaultParam(); ChangeAggressiveState(); Emotion = new EmotionModule(Param.Aggressive, ParamMax); }
internal void DecoderProgram() { if (tlsDecoders.Selection.Count <= 0) { MessageBox.Show("No items selected.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } TreeListNode node = tlsDecoders.Selection[0]; if (node == null) { return; } try { if (node.Tag is AccessoryDecoder) { AccessoryDecoder decoder = node.Tag as AccessoryDecoder; if (decoder != null) { if (decoder.Manufacturer.ID != 0) { MessageBox.Show("Only Railwaymania accessory decoders can be programmed by this command.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DecoderSketch sketch = new DecoderSketch(decoder); sketch.Create(false); sketch.Build(StudioContext.UI.LogConsoleControl); } } } else if (node.Tag is EmotionModule) { EmotionModule module = node.Tag as EmotionModule; if (module != null) { EMotionSketch sketch = new EMotionSketch(module); sketch.Create(false); sketch.Build(StudioContext.UI.LogConsoleControl); } } } catch (Exception ex) { Logger.LogError(this, ex); MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MapModelToView(EmotionModule module) { AccessoryDecoderOutput output; this.Module = module; txtName.Text = this.Module.Name; cboModel.Text = "Railwaymania EasyConnect eMotion"; cboSection.SetSelectedElement(this.Module.Module); txtNotes.Text = this.Module.Notes; chkPushbutton1.Checked = this.Module.Button1Enabled; spinPushbuttonTime1.Value = this.Module.Button1Interval; chkPushbutton2.Checked = this.Module.Button2Enabled; spinPushbuttonTime2.Value = this.Module.Button2Interval; cboModel.Enabled = false; RefreshActionsList(); }
private bool MapViewToModel() { if (string.IsNullOrWhiteSpace(txtName.Text)) { MessageBox.Show("You must provide a valid name for the module.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); txtName.Focus(); return(false); } this.Module.Project = OTCContext.Project; this.Module.Name = txtName.Text.Trim(); this.Module.Model = cboModel.Text.Trim(); this.Module.Module = cboSection.SelectedSection; this.Module.Notes = txtNotes.Text.Trim(); this.Module.Button1Enabled = chkPushbutton1.Checked; this.Module.Button1Interval = Decimal.ToInt32(spinPushbuttonTime1.Value); this.Module.Button2Enabled = chkPushbutton2.Checked; this.Module.Button2Interval = Decimal.ToInt32(spinPushbuttonTime2.Value); return(true); }
/// <summary> /// Returns a new instance of <see cref="EMotionSketch"/>. /// </summary> /// <param name="module">The module for which the sketch is generated.</param> public EMotionSketch(EmotionModule module) { this.Module = module; }
/// <summary> /// Returns a new instance of <see cref="RwmEMotionEditorView"/>. /// </summary> /// <param name="settings">Current application settings.</param> /// <param name="module">The decoder to edit in the editor dialogue.</param> public RwmEMotionEditorView(EmotionModule module) { InitializeComponent(); this.MapModelToView(module); }