private void RepoList_PreviewMouseUp(object sender, MouseButtonEventArgs e) { if (sender == this.RepoList && e.ChangedButton == MouseButton.Right) { // store selected item for later (when context menu selection is done) var fi = this.RepoList.SelectedItem as PackageContainerRepoItem; this.rightClickSelectedItem = fi; // find context menu ContextMenu cm = this.FindResource("ContextMenuFileItem") as ContextMenu; if (cm == null) { return; } // set some fields in context menu var x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxTag"); if (x != null && fi != null) { x.Text = "" + fi.Tag; } x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxDescription"); if (x != null && fi != null) { x.Text = "" + fi.Description; } x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxCode"); if (x != null && fi != null) { x.Text = "" + fi.CodeType2D; } var cb = AasxWpfBaseUtils.FindChildLogicalTree <CheckBox>(cm, "CheckBoxLoadResident"); if (cb != null && fi?.ContainerOptions != null) { cb.IsChecked = fi.ContainerOptions.LoadResident; } cb = AasxWpfBaseUtils.FindChildLogicalTree <CheckBox>(cm, "CheckBoxStayConnected"); if (cb != null && fi?.ContainerOptions != null) { cb.IsChecked = fi.ContainerOptions.StayConnected; } x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxUpdatePeriod"); if (x != null && fi?.ContainerOptions != null) { x.Text = "" + fi.ContainerOptions.UpdatePeriod; } // show context menu cm.PlacementTarget = sender as Button; cm.IsOpen = true; } }
public MessageReportWindow(IEnumerable <StoredPrint> storedPrints) { InitializeComponent(); foreach (var sp in storedPrints) { // Add to rich text box AasxWpfBaseUtils.StoredPrintToRichTextBox( this.RichTextTextReport, sp, AasxWpfBaseUtils.DarkPrintColors, linkClickHandler: link_Click); } }
public void Append(StoredPrint sp) { // access if (sp == null || sp.msg == null) { return; } // add to rich text box AasxWpfBaseUtils.StoredPrintToRichTextBox( this.RichTextTextReport, sp, AasxWpfBaseUtils.DarkPrintColors, linkClickHandler: link_Click); }
public void LogMessage(StoredPrint sp) { // access if (sp == null || sp.msg == null) { return; } // count this.counterMessage++; // check for error var isError = false; foreach (var pattern in patternError) { if (pattern.IsMatch(sp.msg)) { isError = true; } } if (isError || sp.isError) { counterError++; } // add to rich text box AasxWpfBaseUtils.StoredPrintToRichTextBox( this.TextBoxMessages, sp, AasxWpfBaseUtils.BrightPrintColors, isError, link_Click); // move scroll if (this.CheckBoxAutoScroll.IsChecked == true) { this.TextBoxMessages.ScrollToEnd(); } // update status var status = $"Messages: {this.counterMessage}"; if (this.counterError > 0) { status += $" and Errors: {this.counterError}"; } this.TextBoxSummary.Text = status; }
public void LogMessage(StoredPrint sp) { // access if (sp == null || sp.msg == null) { return; } // add to rich text box AasxWpfBaseUtils.StoredPrintToRichTextBox( this.TextBoxMessages, sp, AasxWpfBaseUtils.BrightPrintColors); // move scroll if (true /* this.CheckBoxAutoScroll.IsChecked == true */) { this.TextBoxMessages.ScrollToEnd(); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // init with defaults this.ThisInit(1, 4); // if preset, load first preset if (this.Presets != null && this.Presets.Count > 0) { this.ThisFromPreset(this.Presets[0]); } // placeholders TextBoxPlaceholders.Text = AasxWpfBaseUtils.CleanHereStringWithNewlines( @"All placeholders delimited by %{..}%, {} = set arithmetics, [] = optional {Referable}.{idShort, category, description[@en..], elementName, kind, parent}, {Referable|Identifiable} = {SM, SME, CD}, depth, indent {Identifiable}.{identification[.{idType, id}], administration.{ version, revision}}, {Qualifiable}.qualifiers, {Qualifiable}.multiplicity {Reference}, {Reference}[0..n], {Reference}[0..n].{type, local, idType, value}, {Reference} = {semanticId, isCaseOf, unitId} SME.value, Property.{value, valueType, valueId}, MultiLanguageProperty.{value, vlaueId}, Range.{valueType, min, max}, Blob.{mimeType, value}, File.{mimeType, value}, ReferenceElement.value, RelationshipElement.{first, second}, SubmodelElementCollection.{value = #elements, ordered, allowDuplicates}, Entity.{entityType, asset} CD.{preferredName[@en..], shortName[@en..], unit, unitId, sourceOfDefinition, symbol, dataType, definition[@en..], valueFormat} Commands for header cells include: %fg={color}%, %bg={color}% with {color} = {#a030a0, Red, blue, ..}, %halign={left, center, right}%, %valign={top, center, bottom}%, %font={bold, italic, underline}, %frame={0,1,2,3}% (only whole table)"); // combo Presets ComboBoxPreset.Items.Clear(); if (this.Presets != null && this.Presets.Count > 0) { foreach (var p in this.Presets) { ComboBoxPreset.Items.Add("" + p.Name); } ComboBoxPreset.SelectionChanged += ComboBoxPreset_SelectionChanged; ComboBoxPreset.SelectedIndex = 0; } // combo Formats ComboBoxFormat.Items.Clear(); foreach (var f in ExportTableRecord.FormatNames) { ComboBoxFormat.Items.Add("" + f); } ComboBoxFormat.SelectedIndex = 0; }
private void RepoList_PreviewMouseUp(object sender, MouseButtonEventArgs e) { if (sender == this.RepoList && e.ChangedButton == MouseButton.Right) { // store selected item for later (when context menu selection is done) var fi = this.RepoList.SelectedItem as AasxFileRepository.FileItem; this.rightClickSelectedItem = fi; // find context menu ContextMenu cm = this.FindResource("ContextMenuFileItem") as ContextMenu; if (cm == null) { return; } // set some fields in context menu var x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxTag"); if (x != null && fi != null) { x.Text = "" + fi.Tag; } x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxDescription"); if (x != null && fi != null) { x.Text = "" + fi.Description; } x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxCode"); if (x != null && fi != null) { x.Text = "" + fi.CodeType2D; } // show context menu cm.PlacementTarget = sender as Button; cm.IsOpen = true; } }
public void SetContents( AdminShellPackageEnv package, ConceptModelZveiTechnicalData theDefs, string defaultLang, AdminShell.Submodel sm) { // access if (sm == null) { return; } // section General var smcGeneral = sm.submodelElements.FindFirstSemanticIdAs <AdminShell.SubmodelElementCollection>( theDefs.CD_GeneralInformation.GetSingleKey()); if (smcGeneral != null) { // Product info TextBoxProdDesig.Text = "" + smcGeneral.value.FindFirstSemanticId( theDefs.CD_ManufacturerProductDesignation.GetSingleKey(), allowedTypes: AdminShell.SubmodelElement.PROP_MLP)? .submodelElement?.ValueAsText(defaultLang); TextBoxProdCode.Text = "" + smcGeneral.value.FindFirstSemanticIdAs <AdminShell.Property>( theDefs.CD_ManufacturerOrderCode.GetSingleKey())?.value; TextBoxPartNumber.Text = "" + smcGeneral.value.FindFirstSemanticIdAs <AdminShell.Property>( theDefs.CD_ManufacturerPartNumber.GetSingleKey())?.value; // Manu data TextBoxManuName.Text = "" + smcGeneral.value.FindFirstSemanticIdAs <AdminShell.Property>( theDefs.CD_ManufacturerName.GetSingleKey())?.value; if (package != null) { ImageManuLogo.Source = AasxWpfBaseUtils.LoadBitmapImageFromPackage( package, smcGeneral.value.FindFirstSemanticIdAs <AdminShell.File>( theDefs.CD_ManufacturerLogo.GetSingleKey())?.value ); } // Product Images var pil = new List <ProductImageRecord>(); foreach (var pi in smcGeneral.value.FindAllSemanticIdAs <AdminShell.File>( theDefs.CD_ProductImage.GetSingleKey())) { var data = AasxWpfBaseUtils.LoadBitmapImageFromPackage(package, pi.value); if (data != null) { pil.Add(new ProductImageRecord(data)); } } ItemsControlProductImages.ItemsSource = pil; } // also Section: Product Classifications var smcClassifications = sm.submodelElements.FindFirstSemanticIdAs <AdminShell.SubmodelElementCollection>( theDefs.CD_ProductClassifications.GetSingleKey()); if (smcClassifications != null) { var clr = new List <ClassificationRecord>(); foreach (var smc in smcClassifications.value.FindAllSemanticIdAs <AdminShell.SubmodelElementCollection>( theDefs.CD_ProductClassificationItem.GetSingleKey())) { var sys = ( "" + smc.value.FindFirstSemanticIdAs <AdminShell.Property>( theDefs.CD_ProductClassificationSystem.GetSingleKey())?.value).Trim(); var ver = ( "" + smc.value.FindFirstSemanticIdAs <AdminShell.Property>( theDefs.CD_ClassificationSystemVersion.GetSingleKey())?.value).Trim(); var cls = ( "" + smc.value.FindFirstSemanticIdAs <AdminShell.Property>( theDefs.CD_ProductClassId.GetSingleKey())?.value).Trim(); if (sys != "" && cls != "") { clr.Add(new ClassificationRecord(sys, ver, cls)); } } ItemsControlClassifications.ItemsSource = clr; } }
public void LogMessage(StoredPrint sp) { // access if (sp == null || sp.msg == null) { return; } // Log? if (sp.MessageType == StoredPrint.MessageTypeEnum.Error || sp.MessageType == StoredPrint.MessageTypeEnum.Log) { // count this.counterMessage++; // check for error var isError = false; foreach (var pattern in patternError) { if (pattern.IsMatch(sp.msg)) { isError = true; } } var sumError = false; if (isError || sp.isError || sp.MessageType == StoredPrint.MessageTypeEnum.Error) { counterError++; sumError = true; } // add to rich text box AasxWpfBaseUtils.StoredPrintToRichTextBox( this.TextBoxMessages, sp, AasxWpfBaseUtils.BrightPrintColors, sumError, link_Click); // move scroll if (this.CheckBoxAutoScroll.IsChecked == true) { this.TextBoxMessages.ScrollToEnd(); } } // update status (remembered) if (sp.MessageType == StoredPrint.MessageTypeEnum.Status) { _statusCollected = ""; if (sp.StatusItems != null) { foreach (var si in sp.StatusItems) { if (_statusCollected.HasContent()) { _statusCollected += "; "; } _statusCollected += $"{"" + si.Name} = {"" + si.Value}"; } } } // display status var status = $"Messages: {this.counterMessage}"; if (this.counterError > 0) { status += $" and Errors: {this.counterError}"; } this.TextBoxSummary.Text = status; if (_statusCollected.HasContent()) { this.TextBoxSummary.Text += "; " + _statusCollected; } }