internal List <ControlInformation> GetControlsInformation() { if (this.IsStub) { return(this._stub.GetControlsInformation()); } List <ControlInformation> list = new List <ControlInformation>(base.Owner.Children.Count); foreach (IArrangedElement element in base.Owner.Children) { Control component = element as Control; if (component != null) { ControlInformation item = new ControlInformation(); PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Name"]; if ((descriptor != null) && (descriptor.PropertyType == typeof(string))) { item.Name = descriptor.GetValue(component); } item.Row = this.GetRow(component); item.RowSpan = this.GetRowSpan(component); item.Column = this.GetColumn(component); item.ColumnSpan = this.GetColumnSpan(component); list.Add(item); } } return(list); }
internal List <ControlInformation> GetControlsInformation() { if (IsStub) { return(_stub.GetControlsInformation()); } else { List <ControlInformation> controlsInfo = new List <ControlInformation>(Owner.Children.Count); foreach (IArrangedElement element in Owner.Children) { Control c = element as Control; if (c != null) { ControlInformation controlInfo = new ControlInformation(); // We need to go through the PropertyDescriptor for the Name property // since it is shadowed. PropertyDescriptor prop = TypeDescriptor.GetProperties(c)["Name"]; if (prop != null && prop.PropertyType == typeof(string)) { controlInfo.Name = prop.GetValue(c); } controlInfo.Row = GetRow(c); controlInfo.RowSpan = GetRowSpan(c); controlInfo.Column = GetColumn(c); controlInfo.ColumnSpan = GetColumnSpan(c); controlsInfo.Add(controlInfo); } } return(controlsInfo); } }
/// <devdoc> ApplySettings - applies settings from the stub into a full-fledged /// TableLayoutSettings. /// /// NOTE: this is a one-time only operation - there is data loss to the stub /// as a result of calling this function. we hand as much over to the other guy /// so we dont have to reallocate anything /// </devdoc> internal void ApplySettings(TableLayoutSettings settings) { // // apply row,column,rowspan,colspan // TableLayout.ContainerInfo containerInfo = TableLayout.GetContainerInfo(settings.Owner); Control appliedControl = containerInfo.Container as Control; if (appliedControl != null && controlsInfo != null) { // we store the control names, look up the controls // in the appliedControl's control collection and apply the row,column settings. foreach (object controlName in controlsInfo.Keys) { ControlInformation controlInfo = controlsInfo[controlName]; // Look for the control in our table, we have to go through // PropertyDescriptor rather than just going using appliedControl.Controls[controlName] // because the Name property is shadowed at design time foreach (Control tableControl in appliedControl.Controls) { if (tableControl != null) { string name = null; PropertyDescriptor prop = TypeDescriptor.GetProperties(tableControl)["Name"]; if (prop != null && prop.PropertyType == typeof(string)) { name = prop.GetValue(tableControl) as string; } else { Debug.Fail("Name property missing on control"); } if (WindowsFormsUtils.SafeCompareStrings(name, controlName as string, /* ignoreCase = */ false)) { settings.SetRow(tableControl, controlInfo.Row); settings.SetColumn(tableControl, controlInfo.Column); settings.SetRowSpan(tableControl, controlInfo.RowSpan); settings.SetColumnSpan(tableControl, controlInfo.ColumnSpan); break; } } } } } // // assign over the row and column styles // containerInfo.RowStyles = rowStyles; containerInfo.ColumnStyles = columnStyles; // since we've given over the styles to the other guy, null out. columnStyles = null; rowStyles = null; // set a flag for assertion detection. isValid = false; }
private void SetControlInformation(object controlName, ControlInformation info) { if (controlsInfo == null) { controlsInfo = new Dictionary <object, ControlInformation>(); } controlsInfo[controlName] = info; }
/// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { InitializeComponent(); _controlInformation = new ControlInformation(); PrepareForm(); }
internal ParserInstance(ControlInformation controlInformation) { Assertions.AssertNotNull(controlInformation, "controlInformation"); _controlInformation = controlInformation; _sections = new List<SectionData>(); }
public void SetRowSpan(object controlName, int value) { if (GetRowSpan(controlName) != value) { ControlInformation info = GetControlInformation(controlName); info.RowSpan = value; SetControlInformation(controlName, info); } }
public void SetRow(object controlName, int row) { if (GetRow(controlName) != row) { ControlInformation info = GetControlInformation(controlName); info.Row = row; SetControlInformation(controlName, info); } }
public void SetColumn(object controlName, int column) { if (GetColumn(controlName) != column) { ControlInformation info = GetControlInformation(controlName); info.Column = column; SetControlInformation(controlName, info); } }
private void tsmOpen_Click(object sender, System.EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = Properties.Resources.Controlfile_FilterText; ofd.InitialDirectory = Application.StartupPath; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _controlInformation = ControlInformation.Load(ofd.FileName); UpdateFromControlInformation(); } }
private void LoadControlInformationFile() { string fileName = _configuration.ControlFile; if (string.IsNullOrWhiteSpace(fileName)) { return; } if (!Path.IsPathRooted(fileName)) { fileName = Path.Combine(Utilities.GetWorkingDirectory(), fileName); } _controlInformation = ControlInformation.Load(fileName); }
private void LoadControlInformationFile() { string fileName = SettingsManager.Instance.GetSetting("GenericParser", "ControlFile").GetString(); if (string.IsNullOrWhiteSpace(fileName)) { return; } if (!Path.IsPathRooted(fileName)) { fileName = Path.Combine(Utilities.GetWorkingDirectory(), fileName); } _controlInformation = ControlInformation.Load(fileName); }
internal List <ControlInformation> GetControlsInformation() { if (controlsInfo == null) { return(new List <ControlInformation>()); } List <ControlInformation> listOfControlInfo = new List <ControlInformation>(controlsInfo.Count); foreach (object name in controlsInfo.Keys) { ControlInformation ci = controlsInfo[name]; ci.Name = name; listOfControlInfo.Add(ci); } return(listOfControlInfo); }
private void NavigateToSelectedControl() { if (SelectedControl != null) { var navigationParams = new NavigationParameters(); navigationParams.Add( ControlPageViewModel.ControlInformationParameterName, SelectedControl); NavigationService.RequestNavigate( typeof(ControlPage), navigationParams); // Reset the selection, since we navigated away. // This is required, because the ListView couldn't be "Clicked" otherwise. SelectedControl = null; } }
internal List<ControlInformation> GetControlsInformation() { if (this.IsStub) { return this._stub.GetControlsInformation(); } List<ControlInformation> list = new List<ControlInformation>(base.Owner.Children.Count); foreach (IArrangedElement element in base.Owner.Children) { Control component = element as Control; if (component != null) { ControlInformation item = new ControlInformation(); PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Name"]; if ((descriptor != null) && (descriptor.PropertyType == typeof(string))) { item.Name = descriptor.GetValue(component); } item.Row = this.GetRow(component); item.RowSpan = this.GetRowSpan(component); item.Column = this.GetColumn(component); item.ColumnSpan = this.GetColumnSpan(component); list.Add(item); } } return list; }
/// <summary> /// Saves the parser definition to a file. /// </summary> /// <param name="fileName">The file to save the parser definition to.</param> public void Save(string fileName) { Assertions.AssertNotEmpty(fileName, "fileName"); ControlInformation ci = new ControlInformation(); ci.FaxName = this.ParserName; foreach (SectionDefinitionViewModel svm in this.Sections) { SectionDefinition sd = new SectionDefinition(); sd.SectionString = new GenericParserString(svm.Name); foreach (SectionParserDefinitionViewModel spvm in svm.Aspects) { SectionParserDefinition spd = new SectionParserDefinition(); spd.Type = spvm.Type; spvm.Parser.OnSave(spd.Options); sd.Parsers.Add(spd); } foreach (AreaDefinitionViewModel avm in svm.Areas) { AreaDefinition ad = new AreaDefinition(); ad.AreaString = new GenericParserString(avm.Name); ad.MapToPropertyExpression = avm.MapToPropertyExpression; sd.Areas.Add(ad); } ci.Sections.Add(sd); } ci.Save(fileName); }
private void SetControlInformation(object controlName, ControlInformation info) { _controlsInfo ??= new Dictionary <object, ControlInformation>(); _controlsInfo[controlName] = info; }
internal List<ControlInformation> GetControlsInformation() { if (IsStub) { return _stub.GetControlsInformation(); } else { List<ControlInformation> controlsInfo = new List<ControlInformation>(Owner.Children.Count); foreach (IArrangedElement element in Owner.Children) { Control c = element as Control; if (c != null) { ControlInformation controlInfo = new ControlInformation(); // We need to go through the PropertyDescriptor for the Name property // since it is shadowed. PropertyDescriptor prop = TypeDescriptor.GetProperties(c)["Name"]; if (prop != null && prop.PropertyType == typeof(string)) { controlInfo.Name = prop.GetValue(c); } else { Debug.Fail("Name property missing on control"); } controlInfo.Row = GetRow(c); controlInfo.RowSpan = GetRowSpan(c); controlInfo.Column = GetColumn(c); controlInfo.ColumnSpan = GetColumnSpan(c); controlsInfo.Add(controlInfo); } } return controlsInfo; } }
private void ValidateControlInformation(string name, int column, int row, int columnSpan, int rowSpan, ControlInformation control) { Assert.Equal(name, control.Name); Assert.Equal(column, control.Column); Assert.Equal(row, control.Row); Assert.Equal(columnSpan, control.ColumnSpan); Assert.Equal(rowSpan, control.RowSpan); }
private void SetControlInformation(object controlName, ControlInformation info) { if (controlsInfo == null) { controlsInfo = new Dictionary<object, ControlInformation>(); } controlsInfo[controlName] = info; }