private void button1_Click(object sender, EventArgs e) { using (DefaultControl ctrl = new DefaultControl()) { Console.WriteLine(ctrl.Text); } }
//adds controls to mainPanel private void AddControls() { DefaultControl defaultControl = new DefaultControl(); defaultControl.Dock = DockStyle.Fill; mainPanel.Controls.Add(defaultControl); AddTrailControl addTrailControl = new AddTrailControl(); addTrailControl.Dock = DockStyle.Fill; mainPanel.Controls.Add(addTrailControl); ShowHistoryControl showHistoryControl = new ShowHistoryControl(); showHistoryControl.Dock = DockStyle.Fill; mainPanel.Controls.Add(showHistoryControl); ShowStatsControl showStatsControl = new ShowStatsControl(); showStatsControl.Dock = DockStyle.Fill; mainPanel.Controls.Add(showStatsControl); RandomFactsControl randomFactsControl = new RandomFactsControl(); randomFactsControl.Dock = DockStyle.Fill; randomFactsPanel.Controls.Add(randomFactsControl); mainPanel.Controls["defaultControl"].BringToFront(); }
void Awake() { audioSource = gameObject.GetComponent <AudioSource>(); inputAction = new DefaultControl(); Drum.rightInner += HitRI; Drum.rightOuter += HitRO; Drum.leftInner += HitLI; Drum.leftOuter += HitLO; inputAction.Gameplay.rightInner.performed += ctx => HitRI(); inputAction.Gameplay.rightOuter.performed += ctx => HitRO(); inputAction.Gameplay.leftInner.performed += ctx => HitLI(); inputAction.Gameplay.leftOuter.performed += ctx => HitLO(); //inputAction.Gameplay.DoubleInner.performed += ctx => HitQuality(note.GetComponent<Note>().collideTime); lI = false; lO = false; rI = false; rO = false; projectile = new Utility.Projectile(target.transform, 0.75f); Utility.ResetScore(); enteredQueue = new Queue <GameObject>(); }
void Awake() { inputAction = new DefaultControl(); inputAction.Gameplay.rightInner.performed += ctx => Select(); inputAction.Gameplay.rightOuter.performed += ctx => GoRight(); inputAction.Gameplay.leftInner.performed += ctx => Back(); inputAction.Gameplay.leftOuter.performed += ctx => GoLeft(); }
private void Awake() { controls = new DefaultControl(); controls.Player.CAM1.performed += c1 => Camera1(); controls.Player.CAM2.performed += c2 => Camera2(); cameraOffset = cameraOffset1; cameraRotation = cameraRotation1; }
void Awake() { inputAction = new DefaultControl(); inputAction.Gameplay.rightInner.performed += ctx => Next(); inputAction.Gameplay.rightOuter.performed += ctx => Next(); inputAction.Gameplay.leftInner.performed += ctx => Next(); inputAction.Gameplay.leftOuter.performed += ctx => Next(); }
private void Awake() { controls = new DefaultControl(); controls.UI.Enable(); controls.UI.MapPanX.performed += mpanx => controlDirX = (mpanx.ReadValue <float>()); controls.UI.MapPanY.performed += mpany => controlDirY = (mpany.ReadValue <float>()); orthoSelectorImage.color = new Color(0.3f, 0.3f, 0.3f, 1f); }
void Awake() { Debug.Log("Awake"); inputAction = new DefaultControl(); inputAction.Gameplay.rightInner.performed += ctx => Select(); inputAction.Gameplay.rightOuter.performed += ctx => GoLeft(); //inputAction.Gameplay.leftInner.performed += ctx => HitLI(); inputAction.Gameplay.leftOuter.performed += ctx => GoRight(); //inputAction.Gameplay.DoubleInner.performed += ctx => HitDI(); }
// Start is called before the first frame update void Awake() { inputAction = new DefaultControl(); inputAction.Gameplay.rightInner.performed += ctx => Select(); inputAction.Gameplay.rightOuter.performed += ctx => GoRight(); //inputAction.Gameplay.leftInner.performed += ctx => Next(); inputAction.Gameplay.leftOuter.performed += ctx => GoLeft(); selected = items[0]; }
// Start is called before the first frame update private void Awake() { controls = new DefaultControl(); controls.Player.Throttle.performed += throt => thrustPower = (throt.ReadValue <float>()); controls.Player.Brake.performed += bra => BrakeControlControl(); controls.Player.Steer.performed += str => turnPower = (str.ReadValue <float>()); controls.Player.ParkingBrake.performed += pbrk => ParkingBrake(); controls.Player.Light.performed += light => HeadlightToggle(); rb.centerOfMass = roverCenterOfMass; maxSpeed *= 3.6f; headlights = true; headlightL.intensity = 10; headlightR.intensity = 10; }
void Awake() { inputAction = new DefaultControl(); Drum.rightInner += EnterTheGame; Drum.rightOuter += EnterTheGame; Drum.leftInner += EnterTheGame; Drum.leftOuter += EnterTheGame; inputAction.Gameplay.rightInner.performed += ctx => EnterTheGame(); inputAction.Gameplay.rightOuter.performed += ctx => EnterTheGame(); inputAction.Gameplay.leftInner.performed += ctx => EnterTheGame(); inputAction.Gameplay.leftOuter.performed += ctx => EnterTheGame(); }
public MyInput(DefaultControl input) { _defaultInput = input; _defaultInput.PlayerOnFoot.Move.performed += MoveOnperformed; _defaultInput.PlayerOnFoot.Jump.started += context => IsJump = true; _defaultInput.PlayerOnFoot.Jump.canceled += context => IsJump = false; _defaultInput.PlayerOnFoot.Attack.started += context => IsAttack = true; _defaultInput.PlayerOnFoot.Attack.canceled += context => IsAttack = false; _defaultInput.Enable(); }
private void SetupDefaultControl() { List <StatusLine> Lines = new List <StatusLine>(); StatusLine SummaryLine = new StatusLine(); SummaryLine.AddText("To get started, open an existing Unreal project file on your hard drive."); Lines.Add(SummaryLine); StatusLine OpenLine = new StatusLine(); OpenLine.AddLink("Open project...", FontStyle.Bold | FontStyle.Underline, () => { BrowseForProject(); }); Lines.Add(OpenLine); DefaultControl.Set(Lines); }
void TabControl_OnTabChanged(object NewTabData) { if (IsHandleCreated) { SendMessage(Handle, WM_SETREDRAW, 0, 0); } SuspendLayout(); if (CurrentTabPanel != null) { CurrentTabPanel.Deactivate(); CurrentTabPanel.Hide(); } if (NewTabData == null) { CurrentTabPanel = null; Settings.LastProject = null; DefaultControl.Show(); } else { CurrentTabPanel = (IMainWindowTabPanel)NewTabData; Settings.LastProject = CurrentTabPanel.SelectedProject; DefaultControl.Hide(); } Settings.Save(); if (CurrentTabPanel != null) { CurrentTabPanel.Activate(); CurrentTabPanel.Show(); } ResumeLayout(); if (IsHandleCreated) { SendMessage(Handle, WM_SETREDRAW, 1, 0); } Refresh(); }
void Start() { controls = new DefaultControl(); controls.Enable(); controls.UI.MapShow.performed += shmp => ShowMap(); controls.UI.UIHide.performed += hide => HideUI(); mapView.localScale = hidden; blurLayer.localScale = hidden; mapShown = false; slopeMapShown = false; slopeMapProjector.orthographic = false; SMToggle.color = new Color(0.3f, 0.3f, 0.3f, 1f); SMToggleMap.color = new Color(0.3f, 0.3f, 0.3f, 1f); heightMapShown = false; heightMapProjector.orthographic = false; HMToggle.color = new Color(0.3f, 0.3f, 0.3f, 1f); HMToggleMap.color = new Color(0.3f, 0.3f, 0.3f, 1f); }
private void lstDefault_SelectedIndexChanged(object sender, EventArgs e) { // This Foreach loop changes the colour and font of the all objects back to default foreach (Control DefaultControl in this.Controls) { DefaultControl.BackColor = SystemColors.Window; DefaultControl.ForeColor = SystemColors.WindowText; DefaultControl.Font = Default; if (DefaultControl.GetType() == typeof(Label)) { DefaultControl.BackColor = SystemColors.Control; DefaultControl.ForeColor = SystemColors.ControlText; DefaultControl.Font = Default; } else if (DefaultControl.GetType() == typeof(Button)) { DefaultControl.BackColor = SystemColors.Control; DefaultControl.ForeColor = SystemColors.ControlText; DefaultControl.Font = Default; } } }
void TabControl_OnTabChanged(object NewTabData) { SendMessage(Handle, WM_SETREDRAW, 0, 0); SuspendLayout(); if (CurrentWorkspace != null) { CurrentWorkspace.Deactivate(); CurrentWorkspace.Hide(); } if (NewTabData == null) { CurrentWorkspace = null; Settings.LastProjectFileName = null; DefaultControl.Show(); } else { CurrentWorkspace = (WorkspaceControl)NewTabData; Settings.LastProjectFileName = CurrentWorkspace.SelectedFileName; DefaultControl.Hide(); } Settings.Save(); if (CurrentWorkspace != null) { CurrentWorkspace.Activate(); CurrentWorkspace.Show(); } ResumeLayout(); SendMessage(Handle, WM_SETREDRAW, 1, 0); Refresh(); }
public override void Execute() { if (mUIType == typeof(Node)) { mNode = DefaultControl.CreateNode(mParent); } else if (mUIType == typeof(Image)) { mNode = DefaultControl.CreateImage(mParent).node; } else if (mUIType == typeof(Text)) { mNode = DefaultControl.CreateText(mParent).node; } else if (mUIType == typeof(Button)) { mNode = DefaultControl.CreateButton(mParent).node; } else if (mUIType == typeof(Toggle)) { mNode = DefaultControl.CreateToggle(mParent).node; } else if (mUIType == typeof(TextField)) { mNode = DefaultControl.CreateTextField(mParent).node; } else if (mUIType == typeof(Scrollbar)) { mNode = DefaultControl.CreateScrollbar(mParent).node; } else { throw new NotImplementedException(); } mSelection = UserDatabase.selection.nodes; UserDatabase.selection.nodes = new Node[] { mNode }; }
int TryOpenProject(string ProjectFileName, int ReplaceTabIdx = -1) { Log.WriteLine("Trying to open project {0}", ProjectFileName); // Normalize the filename ProjectFileName = Path.GetFullPath(ProjectFileName).Replace('/', Path.DirectorySeparatorChar); // Make sure the project exists if (!File.Exists(ProjectFileName)) { ShowErrorDialog("{0} does not exist.", ProjectFileName); return(-1); } // Check that none of the other tabs already have it open for (int TabIdx = 0; TabIdx < TabControl.GetTabCount(); TabIdx++) { if (ReplaceTabIdx != TabIdx) { WorkspaceControl Workspace = (WorkspaceControl)TabControl.GetTabData(TabIdx); if (Workspace.SelectedFileName.Equals(ProjectFileName, StringComparison.InvariantCultureIgnoreCase)) { TabControl.SelectTab(TabIdx); return(TabIdx); } else if (ProjectFileName.StartsWith(Workspace.BranchDirectoryName + Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase)) { if (MessageBox.Show(String.Format("{0} is already open under {1}.\n\nWould you like to close it?", Path.GetFileNameWithoutExtension(Workspace.SelectedFileName), Workspace.BranchDirectoryName, Path.GetFileNameWithoutExtension(ProjectFileName)), "Branch already open", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { TabControl.RemoveTab(TabIdx); } else { return(-1); } } } } // Make sure the path case is correct. This can cause UBT intermediates to be out of date if the case mismatches. ProjectFileName = Utility.GetPathWithCorrectCase(new FileInfo(ProjectFileName)); // Detect the project settings in a background thread using (DetectProjectSettingsTask DetectSettings = new DetectProjectSettingsTask(ProjectFileName, Log)) { string ErrorMessage; if (!ModalTaskWindow.Execute(this, DetectSettings, "Opening Project", "Opening project, please wait...", out ErrorMessage)) { if (!String.IsNullOrEmpty(ErrorMessage)) { ShowErrorDialog("{0}", ErrorMessage); } return(-1); } // Hide the default control if it's visible DefaultControl.Hide(); // Now that we have the project settings, we can construct the tab WorkspaceControl Workspace = new WorkspaceControl(this, SqlConnectionString, DataFolder, bRestoreStateOnLoad, OriginalExecutableFileName, ProjectFileName, bUnstable, DetectSettings, Log, Settings); Workspace.Parent = TabPanel; Workspace.Location = new Point(0, 0); Workspace.Size = new Size(TabPanel.Width, TabPanel.Height); Workspace.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; Workspace.Hide(); // Add the tab string NewTabName = GetTabName(Workspace); if (ReplaceTabIdx == -1) { int NewTabIdx = TabControl.InsertTab(-1, NewTabName, Workspace); return(NewTabIdx); } else { TabControl.InsertTab(ReplaceTabIdx + 1, NewTabName, Workspace); TabControl.RemoveTab(ReplaceTabIdx); return(ReplaceTabIdx); } } }
public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference) { if (reference == null) { // Update reference.xml file if (node.Name != "controls") { throw new MpeParserException("Invalid root node <" + node.Name + "> provided."); } // Update the skin node XmlNode skin = node.SelectSingleNode("skin"); if (skin == null) { throw new MpeParserException( "Invalid reference.xml file. The <skin> element must be the first child in the document."); } skin.RemoveAll(); parser.SetValue(doc, skin, "width", Width.ToString()); parser.SetValue(doc, skin, "height", Height.ToString()); // Update the image control node that defines the window background XmlNode image = skin.NextSibling; if (image == null || image.Name.Equals("control") == false) { throw new MpeParserException( "Invalid reference.xml file. A <control> element of type image must follow the <skin> element."); } XmlNode test = image.SelectSingleNode("type"); if (test == null || test.InnerXml.Equals("image") == false) { throw new MpeParserException( "Invalid reference.xml file. A <control> element of type image must follow the <skin> element."); } image.RemoveAll(); backImage.Save(doc, image, parser, null); } else { // Update screen.xml file if (node == null || node.Name.Equals("window") == false) { throw new MpeParserException("Invalid root node <" + node.Name + "> provided. Looking for a <window> element."); } node.RemoveAll(); if (screenType != MpeScreenType.Window) { parser.SetValue(doc, node, "type", screenType.ToString().ToLower()); } parser.SetValue(doc, node, "id", Id.ToString()); parser.SetValue(doc, node, "defaultcontrol", DefaultControl.ToString()); parser.SetValue(doc, node, "allowoverlay", AllowOverlay ? "yes" : "no"); parser.SetValue(doc, node, "autohidetopbar", AutohideTopbar ? "yes" : "no"); XmlElement controls = doc.CreateElement("controls"); node.AppendChild(controls); if (ScreenType == MpeScreenType.Dialog) { MpeGroup dg = DialogGroup; //if (dg.TextureBack != null) { XmlElement image = doc.CreateElement("control"); dg.TextureBackImage.Save(doc, image, parser, parser.GetControl(MpeControlType.Image)); controls.AppendChild(image); //} for (int i = dg.Controls.Count - 1; i >= 0; i--) { if (dg.Controls[i] is MpeControl) { MpeControl control = (MpeControl)dg.Controls[i]; try { XmlElement element = doc.CreateElement("control"); MpeControl referenceControl = parser.GetControl(control.Type); control.Save(doc, element, parser, referenceControl); controls.AppendChild(element); } catch (Exception e) { MpeLog.Debug(e); MpeLog.Error(e); throw new MpeParserException(e.Message); } } } } else { if (TextureBack != null) { XmlElement image = doc.CreateElement("control"); backImage.Save(doc, image, parser, parser.GetControl(MpeControlType.Image)); controls.AppendChild(image); } for (int i = Controls.Count - 1; i >= 0; i--) { if (Controls[i] is MpeControl) { MpeControl control = (MpeControl)Controls[i]; try { XmlElement element = doc.CreateElement("control"); MpeControl referenceControl = parser.GetControl(control.Type); control.Save(doc, element, parser, referenceControl); controls.AppendChild(element); } catch (Exception e) { MpeLog.Debug(e); MpeLog.Error(e); throw new MpeParserException(e.Message); } } } } } }
int TryOpenProject(DetectProjectSettingsTask ProjectSettings, int ReplaceTabIdx, OpenProjectOptions Options) { Log.WriteLine("Trying to open project {0}", ProjectSettings.SelectedProject.ToString()); // Check that none of the other tabs already have it open for (int TabIdx = 0; TabIdx < TabControl.GetTabCount(); TabIdx++) { if (ReplaceTabIdx != TabIdx) { WorkspaceControl Workspace = TabControl.GetTabData(TabIdx) as WorkspaceControl; if (Workspace != null) { if (Workspace.SelectedFileName.Equals(ProjectSettings.NewSelectedFileName, StringComparison.InvariantCultureIgnoreCase)) { Log.WriteLine(" Already open in tab {0}", TabIdx); if ((Options & OpenProjectOptions.Quiet) == 0) { TabControl.SelectTab(TabIdx); } return(TabIdx); } else if (ProjectSettings.NewSelectedFileName.StartsWith(Workspace.BranchDirectoryName + Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase)) { if ((Options & OpenProjectOptions.Quiet) == 0 && MessageBox.Show(String.Format("{0} is already open under {1}.\n\nWould you like to close it?", Path.GetFileNameWithoutExtension(Workspace.SelectedFileName), Workspace.BranchDirectoryName, Path.GetFileNameWithoutExtension(ProjectSettings.NewSelectedFileName)), "Branch already open", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { Log.WriteLine(" Another project already open in this workspace, tab {0}. Replacing.", TabIdx); TabControl.RemoveTab(TabIdx); } else { Log.WriteLine(" Another project already open in this workspace, tab {0}. Aborting.", TabIdx); return(-1); } } } } } // Hide the default control if it's visible DefaultControl.Hide(); // Remove the current tab. We need to ensure the workspace has been shut down before creating a new one with the same log files, etc... if (ReplaceTabIdx != -1) { WorkspaceControl OldWorkspace = TabControl.GetTabData(ReplaceTabIdx) as WorkspaceControl; if (OldWorkspace != null) { OldWorkspace.Hide(); TabControl.SetTabData(ReplaceTabIdx, new ErrorPanel(ProjectSettings.SelectedProject)); OldWorkspace.Dispose(); } } // Now that we have the project settings, we can construct the tab WorkspaceControl NewWorkspace = new WorkspaceControl(this, ApiUrl, OriginalExecutableFileName, bUnstable, ProjectSettings, Log, Settings); NewWorkspace.Parent = TabPanel; NewWorkspace.Dock = DockStyle.Fill; NewWorkspace.Hide(); // Add the tab string NewTabName = GetTabName(NewWorkspace); if (ReplaceTabIdx == -1) { int NewTabIdx = TabControl.InsertTab(-1, NewTabName, NewWorkspace); Log.WriteLine(" Inserted tab {0}", NewTabIdx); return(NewTabIdx); } else { Log.WriteLine(" Replacing tab {0}", ReplaceTabIdx); TabControl.InsertTab(ReplaceTabIdx + 1, NewTabName, NewWorkspace); TabControl.RemoveTab(ReplaceTabIdx); return(ReplaceTabIdx); } }
public BaseBinder() : base() { Controllers = new Dictionary <string, IDBController>(); Mapper = new Dictionary <string, Control>(); Prop = new Func <string, PropertyInfo>(x => typeof(M).GetProperty(x)); isBoolean = new Func <string, bool>(x => Mapper[x].GetType() == typeof(CheckBox) && Prop(x).PropertyType == typeof(bool)); isDateTime = new Func <string, bool>(x => Prop(x).PropertyType == typeof(DateTime) || Prop(x).PropertyType == typeof(DateTime?)); isInt64 = new Func <string, bool>(x => Prop(x).PropertyType == typeof(Int64)); isInt32 = new Func <string, bool>(x => Prop(x).PropertyType == typeof(Int32) || Prop(x).PropertyType == typeof(int)); isDouble = new Func <string, bool>(x => Prop(x).PropertyType == typeof(double) || Prop(x).PropertyType == typeof(Double)); //Load += (s, e) => { // if (DesignMode || (Site != null && Site.DesignMode)) return; new PermissionsHelper <M>(this); foreach (var control in Mapper.Values.OrderBy(x => x.TabIndex)) { if (DefaultControl == null && control.TabStop) { DefaultControl = control; } control.KeyDown += delegate(object sender, KeyEventArgs ea) { if (ea.KeyCode == Keys.Enter) { ea.SuppressKeyPress = true; ea.Handled = true; SendKeys.Send("\t"); } }; } DefaultControl?.Focus(); if (SaveButton != null) { SaveButton.Enabled = SaveButtonEnabled; SaveButton.Click += (bs, be) => { try { Controller.Save(Model); Model = Controller.Find(Model, Controller.GetMetaData().UniqueKeyFields.ToArray()); AfterSave?.Invoke(); DefaultControl.Focus(); DefaultControl.Select(); }catch (Exception ex) { FormsHelper.Error(ex.Message); } }; } if (DeleteButton != null) { DeleteButton.Enabled = DeleteButtonEnabled; DeleteButton.Click += (bs, be) => { Controller.Delete(Model); NewButton?.PerformClick(); }; } if (NewButton != null) { NewButton.Enabled = NewButtonEnabled; NewButton.Click += (bs, be) => { Model = Controller.NewModel <M>(); }; } //}; }
private void CheckControls() { DefaultControl defaultControl = new DefaultControl(); defaultControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(defaultControl); CalculatorsControl calculatorsControl = new CalculatorsControl(); calculatorsControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(calculatorsControl); OneRepMaxControl oneRepMaxControl = new OneRepMaxControl(); oneRepMaxControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(oneRepMaxControl); BMIControl bMIControl = new BMIControl(); bMIControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(bMIControl); CPMControl cPMControl = new CPMControl(); cPMControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(cPMControl); RoutinesControl routinesControl = new RoutinesControl(); routinesControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(routinesControl); RoutinesManagerControl routinesManagerControl = new RoutinesManagerControl(); routinesManagerControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(routinesManagerControl); ProfileControl profileControl = new ProfileControl(); profileControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(profileControl); ModifyProfileControl modifyProfilControl = new ModifyProfileControl(); modifyProfilControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(modifyProfilControl); ShowProfileControl showProfileControl = new ShowProfileControl(); showProfileControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(showProfileControl); CreateRoutineUserControl createRoutineUserControl = new CreateRoutineUserControl(); createRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(createRoutineUserControl); AddSessionUserControl addSessionUserControl = new AddSessionUserControl(); addSessionUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(addSessionUserControl); AddRoutineUserControl addRoutineUserControl = new AddRoutineUserControl(); addRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(addRoutineUserControl); ShowWorkoutRoutineUserControl showWorkoutRoutineUserControl = new ShowWorkoutRoutineUserControl(); showWorkoutRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(showWorkoutRoutineUserControl); AddStretchingRoutineUserControl addStretchingRoutineUserControl = new AddStretchingRoutineUserControl(); addStretchingRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(addStretchingRoutineUserControl); AddStretchingSessionUserControl addStretchingSessionUserControl = new AddStretchingSessionUserControl(); addStretchingSessionUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(addStretchingSessionUserControl); ShowStretchingRoutineUserControls showStretchingRoutineUserControls = new ShowStretchingRoutineUserControls(); showStretchingRoutineUserControls.Dock = DockStyle.Fill; CentralPanel.Controls.Add(showStretchingRoutineUserControls); StretchingRoutinesManagerControl stretchingRoutinesManagerControl = new StretchingRoutinesManagerControl(); stretchingRoutinesManagerControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(stretchingRoutinesManagerControl); CreateStretchingRoutineUserControl createStretchingRoutineUserControl = new CreateStretchingRoutineUserControl(); createStretchingRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(createStretchingRoutineUserControl); CardioRoutineManagerUserControl cardioRoutineManagerUserControl = new CardioRoutineManagerUserControl(); cardioRoutineManagerUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(cardioRoutineManagerUserControl); AddCardioRoutineUserControl addCardioRoutineUserControl = new AddCardioRoutineUserControl(); addCardioRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(addCardioRoutineUserControl); CreateCardioRoutineUserControl createCardioRoutineUserControl = new CreateCardioRoutineUserControl(); createCardioRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(createCardioRoutineUserControl); AddCardioSessionUserControl addCardioSessionUserControl = new AddCardioSessionUserControl(); addCardioSessionUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(addCardioSessionUserControl); ShowCardioRoutineUserControl showCardioRoutineUserControl = new ShowCardioRoutineUserControl(); showCardioRoutineUserControl.Dock = DockStyle.Fill; CentralPanel.Controls.Add(showCardioRoutineUserControl); }
private void NewModelEvent(object sender, EventArgs e) { Model = Controller.NewModel(); DefaultControl?.Select(); AfterNew?.Invoke(true); }
private void InitializeView() { SuspendLayout(); //Thread.Sleep(10); var md = Controller.GetMetaData(); var uqkeys = md.UniqueKeyFields.Flatten(); var rqkeys = md.RequiredFields; var sizes = md.Sizes; foreach (var cntrl in uqkeys.Where(x => Mapper.ContainsKey(x))) { Mapper[cntrl].BackColor = GREEN; } foreach (var cntrl in rqkeys.Where(x => Mapper.ContainsKey(x))) { Controls.Add(new Label() { Name = $"RQ_{cntrl}", Text = "*", ForeColor = Color.Red, Top = Mapper[cntrl].Top + 5, Left = Mapper[cntrl].Left - 15 }); } foreach (var cntrl in sizes.Where(x => Mapper.ContainsKey(x.Key) && Mapper[x.Key] is TextBox)) { ((TextBox)Mapper[cntrl.Key]).MaxLength = cntrl.Value; } new PermissionsHelper <M, C>(this); if (SaveButton != null) { SaveButton.Click += SaveModelEvent; } if (DeleteButton != null) { DeleteButton.Click += DeleteModelEvent; } if (NewButton != null) { NewButton.Click += NewModelEvent; } //var controls = (from cntrl in Mapper.Values orderby cntrl.TabIndex where cntrl.TabStop select cntrl); var xcld = new[] { "Id", "CreatedBy", "CreatedOn", "UpdatedBy", "UpdatedOn" }; foreach (string cntrl in Mapper.Keys) { Mapper[cntrl].Name = cntrl; Mapper[cntrl].KeyDown += MapperControlKeyDownEvent; if ((xcld.Contains(cntrl) || Mapper[cntrl].BackColor.Equals(GREEN)) == false) { Mapper[cntrl].BackColor = Color.White; } if ("Id".Equals(cntrl)) { (Mapper[cntrl] as TextBox).ReadOnly = true; Mapper[cntrl].TextChanged += (ts, te) => { SetModel(Mapper[cntrl].Text.ToInteger()); }; } } foreach (var lookup in PickList) { lookup.Value.ReadOnly = true; lookup.Key.PickListItemSelected += (int id) => { lookup.Value.Text = id.ToString(); }; lookup.Value.KeyPress += (ls, le) => { lookup.Key.PerformClick(); lookup.Key.SetFilter(le.KeyChar); }; } DefaultControl = Mapper.Values.Where(x => x.TabStop).OrderBy(x => x.TabIndex).FirstOrDefault(); DefaultControl?.Focus(); ResumeLayout(); Invalidate(); }