void GetTitle(string mType) { List <yuan.YuanMemoryDB.YuanRow> listRow = YuanUnityPhoton.GetYuanUnityPhotonInstantiate().ytHelp.SelectRowsListEqual("HelpType", mType); foreach (BtnHelp item in listTitle) { item.gameObject.SetActive(false); } if (listRow != null) { int num = 0; BtnHelp btn; foreach (yuan.YuanMemoryDB.YuanRow item in listRow) { if (listTitle.Count > num) { listTitle[num].yr = item; listTitle[num].title.text = item["HelpName"].YuanColumnText; listTitle[num].info = this.lblInfo; listTitle[num].gameObject.SetActive(true); btn = listTitle[num]; } else { BtnHelp tempBtn = (BtnHelp)Instantiate(insBtnHelp); tempBtn.transform.parent = gridTitle.transform; tempBtn.transform.localScale = Vector3.one; tempBtn.transform.localPosition = Vector3.zero; tempBtn.myCkb.group = 8; tempBtn.yr = item; tempBtn.title.text = item["HelpName"].YuanColumnText; tempBtn.info = this.lblInfo; listTitle.Add(tempBtn); btn = tempBtn; } if (num == 0) { btn.OnClick(); } num++; } gridTitle.repositionNow = true; } }
void IndividualEditPanel_Loaded(object sender, RoutedEventArgs e) { this.ParentWindow = Window.GetWindow(this); if (this.ParentWindow == null) { throw new InternalAnomaly("Window cannot be obtained for this UserControl."); } this.BtnApply = this.GetTemplateChild <PaletteButton>("BtnApply"); BtnApply.SetVisible(this.ShowApply, true); //this.BtnRefresh = this.GetTemplateChild<PaletteButton>("BtnRefresh"); //BtnRefresh.SetVisible(this.ShowRefresh, false); this.BtnAdvanced = this.GetTemplateChild <PaletteToggleButton>("BtnAdvanced"); this.BtnHelp = this.GetTemplateChild <PaletteButton>("BtnHelp"); BtnHelp.SetVisible(this.HasHelpForShowing, false); this.BtnOK = this.GetTemplateChild <PaletteButton>("BtnOK"); this.BtnCancel = this.GetTemplateChild <PaletteButton>("BtnCancel"); this.ShowAdvancedMembers = AppExec.GetConfiguration <bool>("UserInterface", "ShowAdvancedProperties", false); this.BtnAdvanced.IsChecked = this.ShowAdvancedMembers; this.ParentWindow.Loaded += new RoutedEventHandler(ParentWindow_Loaded); this.ParentWindow.Closing += new System.ComponentModel.CancelEventHandler(ParentWindow_Closing); this.ParentWindow.Closed += new EventHandler(ParentWindow_Closed); this.BtnHelp.SetVisible(this.HasHelpForShowing); // Asked here because may have been setted before template load if (!this.CanCancelEditing) { this.BtnCancel.IsEnabled = false; } // Append extra buttons var PnlButtons = this.GetTemplateChild <Panel>("PnlButtons"); if (PnlButtons != null && this.ExtraButtons != null && this.ExtraButtons.Count > 0) { foreach (var Extra in this.ExtraButtons) { var LocalExtra = Extra; var NewButton = new PaletteButton(LocalExtra.Item1, LocalExtra.Item3, Summary: LocalExtra.Item2); NewButton.Margin = new Thickness(2); NewButton.Click += ((sndr, args) => LocalExtra.Item4(this.AssociatedEntity)); PnlButtons.Children.Add(NewButton); } } // Set header var Header = Display.GetTemplateChild <Border>(this, "BrdHeader"); if (Header == null) { return; } Header.Child = this.HeaderContent; Header.SetVisible(this.HeaderContent != null); }