protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { nameTextBox.Text = string.Empty; descriptionTextBox.Text = string.Empty; toolTip.SetToolTip(descriptionTextBox, string.Empty); if (ViewAttribute.HasViewAttribute(this.GetType())) { this.Caption = ViewAttribute.GetViewName(this.GetType()); } else { this.Caption = "NamedOKBItem View"; } } else { nameTextBox.Text = Content.Name; descriptionTextBox.Text = Content.Description; toolTip.SetToolTip(descriptionTextBox, Content.Description); Caption = Content.Name; } }
private void a26MewQeye() { this.KlQMF7RVxb.VirtualListSize = 0; this.KlQMF7RVxb.Columns.Clear(); if (this.ASnMxoTP6b == null || this.ASnMxoTP6b.Count <= 0) { return; } this.KlQMF7RVxb.VirtualListSize = this.ASnMxoTP6b.Count; this.KlQMF7RVxb.Columns.Add(RNaihRhYEl0wUmAftnB.aYu7exFQKN(31540), 30, HorizontalAlignment.Left); this.KlQMF7RVxb.Columns.Add(RNaihRhYEl0wUmAftnB.aYu7exFQKN(31546), 130, HorizontalAlignment.Left); this.LOMMDbeLeH = new ArrayList(); foreach (PropertyInfo propertyInfo in this.ASnMxoTP6b[0].GetType().GetProperties()) { object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(ViewAttribute), true); if (customAttributes.Length > 0) { ViewAttribute viewAttribute = customAttributes[0] as ViewAttribute; string name = propertyInfo.Name; string str = viewAttribute is PriceViewAttribute ? this.XymMdYIa1B : (string)null; this.KlQMF7RVxb.Columns.Add(name, 75, HorizontalAlignment.Right); this.LOMMDbeLeH.Add((object)new i4bbcTzQMD8sE0b5HS(str, propertyInfo)); } } }
private void RefreshMenuItems() { if (InvokeRequired) { Invoke((Action)RefreshMenuItems); } else { foreach (ToolStripMenuItem m in menuItems.Values) { m.Dispose(); } this.Items.Clear(); this.menuItems.Clear(); if (this.item != null) { ToolStripMenuItem menuItem; IEnumerable <Type> types = MainFormManager.GetViewTypes(item.GetType(), true); foreach (Type t in types.Except(IgnoredViewTypes)) { menuItem = new ToolStripMenuItem(); menuItem.Tag = t; menuItem.Text = ViewAttribute.GetViewName(t); this.menuItems.Add(t, menuItem); this.Items.Add(menuItem); } } } }
public void BasicTests() { var attribute = new ViewAttribute("test"); Assert.AreEqual("test", attribute.Name); Assert.IsTrue(String.IsNullOrWhiteSpace(attribute.Schema)); attribute = new ViewAttribute("test") { Schema = "dbo" }; Assert.AreEqual("test", attribute.Name); Assert.AreEqual("dbo", attribute.Schema); ExceptionAssert.Throws <ArgumentNullException>(() => new ViewAttribute(null)); ExceptionAssert.Throws <ArgumentException>(() => new ViewAttribute(String.Empty)); ExceptionAssert.Throws <ArgumentNullException>(() => new ViewAttribute("test") { Schema = null }); ExceptionAssert.Throws <ArgumentException>(() => new ViewAttribute("test") { Schema = String.Empty }); }
private int CalculateHelpLabelPosY() { if (activeView != null && ViewAttribute.HasHelpResourcePath(activeView.GetType()) && !configurationLabel.Visible) { return(configurationLabel.Top); } return(configurationLabel.Bottom + configurationLabel.Margin.Bottom + helpLabel.Margin.Top); }
protected void AddViewListViewItem(Type viewType, Image image) { ListViewItem listViewItem = new ListViewItem(); listViewItem.Text = ViewAttribute.GetViewName(viewType); itemsListView.SmallImageList.Images.Add(image); listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1; listViewItem.Tag = viewType; itemsListView.Items.Add(listViewItem); AdjustListViewColumnSizes(); }
/// <summary> /// Creates a WinformsViewInfo object by a given ViewAttribute instance. /// </summary> #endregion protected override ViewInfo newViewInfo(Type viewType, ViewAttribute viewAttr) { WinformsViewInfo viewInfo = new WinformsViewInfo(viewType); if (!(viewAttr is WinformsViewAttribute)) { return(viewInfo); } viewInfo.IsMdiParent = (viewAttr as WinformsViewAttribute).IsMdiParent; viewInfo.MdiParent = (viewAttr as WinformsViewAttribute).MdiParent; viewInfo.ShowModal = (viewAttr as WinformsViewAttribute).ShowModal; return(viewInfo); }
public T GetPopUpView <T>() where T : BaseView { Type type = typeof(T); ViewAttribute viewAttribute = (ViewAttribute)Attribute.GetCustomAttribute(type, typeof(ViewAttribute)); foreach (BaseView view in viewCache) { if (view is T) { return((T)view); } } return(null); }
public View() { InitializeComponent(); this.initialized = false; this.isShown = false; this.closeReason = CloseReason.None; this.readOnly = false; if (ViewAttribute.HasViewAttribute(this.GetType())) { this.Caption = ViewAttribute.GetViewName(this.GetType()); } else { this.Caption = "View"; } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); var viewTypes = MainFormManager.GetViewTypes(typeof(RunCollection), true); foreach (Type viewType in viewTypes.OrderBy(x => ViewAttribute.GetViewName(x))) { if ((viewType != typeof(ItemCollectionView <IRun>)) && (viewType != typeof(ViewHost))) { ToolStripMenuItem menuItem = new ToolStripMenuItem(); menuItem.Text = ViewAttribute.GetViewName(viewType); menuItem.Tag = viewType; menuItem.Click += new EventHandler(menuItem_Click); analyzeRunsToolStripDropDownButton.DropDownItems.Add(menuItem); } } }
private void findViewsAndViewModels() { this.logger.Log($"NavigationService.findViewsAndViewModels: entered"); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly currentAssembly in assemblies) { //this.logger.Log($"NavigationService.findViewsAndViewModels: iterating through Assemblies, currently: '{currentAssembly.FullName}'"); try { foreach (Type currentType in currentAssembly.GetTypes()) { //this.logger.Log($"NavigationService.findViewsAndViewModels: iterating through Types in Assembly '{currentAssembly.FullName}', currently: '{currentType.FullName}'"); ViewModelAttribute viewModelAttribute = null; ViewAttribute viewAttribute = null; foreach (object customAttribute in currentType.GetCustomAttributes(true)) { if (customAttribute is ViewModelAttribute) { viewModelAttribute = customAttribute as ViewModelAttribute; } else if (customAttribute is ViewAttribute) { viewAttribute = customAttribute as ViewAttribute; } if (viewModelAttribute != null && viewAttribute != null) { this.logger.Log($"NavigationService.findViewsAndViewModels: successfully found a ViewModelAttribute AND a ViewAttribute in Assembly '{currentAssembly.FullName}', Type: '{currentType.FullName}'"); if (!this.viewsAndViewModels.ContainsValue(viewModelAttribute.ViewModelName)) { this.viewsAndViewModels.Add(viewAttribute.ViewUri, viewModelAttribute.ViewModelName); } } } } } catch (Exception ex) { this.logger.Log($"NavigationService.findViewsAndViewModels: iterating through Types in Assembly '{currentAssembly.FullName}', Exception: '{ex}, {ex.Message}'", Contracts.Logger.Enums.LogLevel.Error); } } this.logger.Log($"NavigationService.findViewsAndViewModels: exited"); }
public T AddPopUpView <T>(object data = null) where T : BaseView { Type type = typeof(T); ViewAttribute viewAttribute = (ViewAttribute)Attribute.GetCustomAttribute(type, typeof(ViewAttribute)); Transform layer = null; if (!viewLayers.TryGetValue(viewAttribute.layer, out layer)) { return(null); } if (viewAttribute.isSingleton) { foreach (BaseView _view in viewCache) { if (_view is T) { return((T)_view); } } } BaseView view = ResourceUtils.GetComponent <BaseView>(viewAttribute.prefabPath); view.transform.parent = layer.transform; view.transform.localScale = Vector3.one; view.transform.localRotation = Quaternion.identity; view.transform.localPosition = layer.transform.localPosition; viewCache.Add(view); view.Show(data); EventBox.Send(CustomEvent.WINDOW_OPEN, view.GetType()); return((T)view); }
protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { nameTextBox.Text = string.Empty; toolTip.SetToolTip(infoLabel, string.Empty); if (ViewAttribute.HasViewAttribute(this.GetType())) { this.Caption = ViewAttribute.GetViewName(this.GetType()); } else { this.Caption = "NamedItem View"; } } else { nameTextBox.Text = Content.Name; toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix); Caption = Content.Name; } }
protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { viewHost.Content = null; toolTip.SetToolTip(infoLabel, string.Empty); if (ViewAttribute.HasViewAttribute(this.GetType())) { this.Caption = ViewAttribute.GetViewName(this.GetType()); } else { this.Caption = "ResultValue View"; } } else { viewHost.ViewType = null; viewHost.Content = Content.Value; toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + Environment.NewLine + Environment.NewLine + infoLabelToolTipSuffix); Caption = Content.Name; } }
public static string RenderValue(ViewAttribute item) { string result = String.Empty; var kvRegex = new Regex(@"^(\d+):(.+)"); Match valueMatch = null; if (item.AttributeType == AttributeType.Text || item.AttributeType == AttributeType.Number) { valueMatch = kvRegex.Match(item.Value.ToString()); } switch (item.AttributeType) { case AttributeType.Text: if (valueMatch.Success) { var key = int.Parse(valueMatch.Groups[1].Value); var value = valueMatch.Groups[2].Value; var list = new Dictionary <int, string>(); foreach (var postfixItem in item.Posfix.Split(',').Select(p => p.Trim())) { var pfMatch = kvRegex.Match(postfixItem); list.Add(int.Parse(pfMatch.Groups[1].Value), pfMatch.Groups[2].Value); } result = value; item.Posfix = list[key]; } else { result = item.Value.ToString(); } break; case AttributeType.Number: if (valueMatch.Success) { var key = int.Parse(valueMatch.Groups[1].Value); var value = float.Parse(valueMatch.Groups[2].Value); var list = new Dictionary <int, string>(); foreach (var postfixItem in item.Posfix.Split(',').Select(p => p.Trim())) { var pfMatch = kvRegex.Match(postfixItem); list.Add(int.Parse(pfMatch.Groups[1].Value), pfMatch.Groups[2].Value); } result = Math.Round(value, 1).ToString(); item.Posfix = list[key]; } else { result = item.Value.ToString(); } break; case AttributeType.SingleItem: result = item.Options.FirstOrDefault(op => op.ID == (int)item.Value).Title; if (result == "ندارد") { result = "<i class='fa fa-times'></i>"; } break; case AttributeType.MultipleItem: var options = item.Options.Where(op => ((IList)item.Value).Contains(op.ID)); if (options.Count() > 0) { foreach (var op in options) { result += op.Title + " - "; } result = result.Remove(result.Length - 2, 1); } break; case AttributeType.Check: if ((bool)item.Value) { result = "<i class='fa fa-check'></i>"; } else { result = "<i class='fa fa-times'></i>"; } break; case AttributeType.MultilineText: result = item.Value.ToString(); if (!Utilities.ContainsUnicodeCharacter(result)) { result = "<span dir='ltr'>" + result + "</span>"; } result = result.Replace("\n", "<br />"); break; default: result = "نا معلوم"; break; } if (!OnlineStore.Providers.Utilities.ContainsUnicodeCharacter(result)) { result = "<span dir='ltr'>" + result + "</span>"; } return(result); }
private void UpdateCaption() { Caption = Content != null ? Content.OptimizerName + " Chart Analysis" : ViewAttribute.GetViewName(GetType()); }
private void UpdateCaption() { Caption = Content != null ? Content.OptimizerName + " Box Plot" : ViewAttribute.GetViewName(GetType()); }
private void UpdateCaption() { Caption = Content != null ? Content.OptimizerName + " Statistical Tests" : ViewAttribute.GetViewName(GetType()); }
private void helpLabel_DoubleClick(object sender, EventArgs e) { using (InfoBox dialog = new InfoBox("Help for " + ViewAttribute.GetViewName(ActiveView.GetType()), ViewAttribute.GetHelpResourcePath(ActiveView.GetType()), ActiveView)) { dialog.ShowDialog(this); } }
protected override ViewInfo newViewInfo(Type viewType, ViewAttribute vAtr) { return(new ViewInfoEx(vAtr.ViewName, (vAtr as ViewExAttribute).ImgName, viewType)); }
private void UpdateCaption() { Caption = Content != null ? Content.OptimizerName + " Sample Size Influence" : ViewAttribute.GetViewName(GetType()); }
protected virtual void UpdateCaption() { Caption = Content != null ? Content.OptimizerName + " Chart Combination" : ViewAttribute.GetViewName(GetType()); }
protected override void UpdateCaption() { Caption = Content != null ? Content.OptimizerName + " Chart Average" : ViewAttribute.GetViewName(GetType()); }
private void ParseView(Type type, DatabaseTypeInfo toAdd) { ViewAttribute dField = type.GetCustomAttributes(typeof(ViewAttribute), true).FirstOrDefault() as ViewAttribute; toAdd.IsView = dField != null ? true : false; }