/// <summary> /// Update the values specified for the Support Statistics /// </summary> private void UpdateSupportStatistics() { StatisticsDAO awDataAccess = new StatisticsDAO(); DataTable statisticsTable, statisticsTableAsset; SupportContractStatistics statistics, statisticsAsset; statisticsTable = awDataAccess.SupportStatistics(); statisticsTableAsset = awDataAccess.SupportStatisticsAsset(); statistics = new SupportContractStatistics(statisticsTable.Rows[0]); statisticsAsset = new SupportContractStatistics(statisticsTableAsset.Rows[0]); int iCountExpired = statistics.Expired + statisticsAsset.Expired; int iCountExpireToday = statistics.ExpireToday + statisticsAsset.ExpireToday; int iCountExpireWeek = statistics.ExpireWeek + statisticsAsset.ExpireWeek; int iCountExpireMonth = statistics.ExpireMonth + statisticsAsset.ExpireMonth; // UltraExplorerBarGroup supportContracts = overviewExplorerBar.Groups["supportcontracts"]; if (supportContracts == null) { return; } supportContracts.Items["expired"].Text = StatisticTitles.SupportExpired + iCountExpired.ToString(); supportContracts.Items["expirestoday"].Text = StatisticTitles.SupportExpireToday + iCountExpireToday.ToString(); supportContracts.Items["expiresthisweek"].Text = StatisticTitles.SupportExpireThisWeek + iCountExpireWeek.ToString(); supportContracts.Items["expiresthismonth"].Text = StatisticTitles.SupportExpireThisMonth + iCountExpireMonth.ToString(); }
/// <summary> /// Initializes a new <see cref="ExplorerBarGroupOwnerUIAdapter"/> /// </summary> /// <param name="group">Group whose owning collection will be updated with any added elements.</param> public ExplorerBarGroupOwnerUIAdapter(UltraExplorerBarGroup group) : base(group.ExplorerBar.Groups) { Guard.ArgumentNotNull(group, "group"); this.group = group; }
public void MostrarItems() { uebContenedor.Groups.Clear(); foreach (ItemContenedor Item in Contenedor.Items) { if (Item.EsContenedor) { UltraExplorerBarGroup Group = new UltraExplorerBarGroup(); UltraExplorerBarContainerControl Container = new UltraExplorerBarContainerControl(); UltraTree Tree = new UltraTree(); uebContenedor.Controls.Add(Container); Tree.Dock = DockStyle.Fill; Tree.NodeConnectorStyle = NodeConnectorStyle.None; Tree.ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.Standard; Tree.DisplayStyle = UltraTreeDisplayStyle.WindowsVista; Tree.AfterSelect += Tree_AfterSelect; Container.Controls.Add(Tree); Group.Text = Item.Nombre; Group.Settings.AppearancesLarge.HeaderAppearance.Image = ilMain.Images[Item.Imagen]; Group.Tag = Item; Group.Container = Container; Group.Settings.Style = GroupStyle.ControlContainer; uebContenedor.Groups.Add(Group); AddNodesToTree(Tree.Nodes, Item); Tree.ExpandAll(); } } }
private void uebContenedor_GroupClick(object sender, GroupEventArgs e) { this.ItemContenedor = (ItemContenedor)uebContenedor.ActiveGroup.Tag; this.MostrarItemContenedor(); this.GroupActive = uebContenedor.ActiveGroup; ubAñadirModificar.Text = "Modificar"; }
public void ConstruirContenedores() { ObtenerContenedor(); if (m_Contenedor != null) { uebMain.Groups.Clear(); foreach (ItemContenedor Item in m_Contenedor.Items) { if (Item.EsContenedor) { UltraExplorerBarGroup Group = new UltraExplorerBarGroup(); UltraExplorerBarContainerControl Container = new UltraExplorerBarContainerControl(); UltraTree Tree = new UltraTree(); uebMain.Controls.Add(Container); Tree.Dock = DockStyle.Fill; Tree.NodeConnectorStyle = NodeConnectorStyle.None; Tree.ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.Standard; Tree.DisplayStyle = UltraTreeDisplayStyle.WindowsVista; Tree.Override.ActiveNodeAppearance.FontData.Bold = DefaultableBoolean.True; Tree.AfterSelect += Tree_AfterSelect; Tree.Click += Tree_Click; Container.Controls.Add(Tree); Group.Text = Item.Nombre; Group.Settings.NavigationPaneCollapsedGroupAreaText = Item.Nombre; Group.Settings.AppearancesLarge.HeaderAppearance.Image = ilMain.Images[Item.Imagen]; Group.Tag = Item; Group.Container = Container; Group.Settings.Style = GroupStyle.ControlContainer; uebMain.Groups.Add(Group); AddNodesToTree(Tree.Nodes, Item); Tree.ExpandAll(); } } } }
private void HideEmptyGroups() { UltraExplorerBarGroup group = null; foreach (UltraExplorerBarGroup group2 in this.m_ExplorerBar.Groups) { if (group2.Settings.Style == GroupStyle.ControlContainer) { continue; } bool flag = false; UltraExplorerBarItemsCollection.UltraExplorerBarItemEnumerator enumerator2 = group2.Items.GetEnumerator(); while (enumerator2.MoveNext()) { if (enumerator2.Current.Visible) { flag = true; goto Label_0071; } } Label_0071: group2.Visible = flag; if (flag) { group = group2; } } if (group != null) { this.m_ExplorerBar.ActiveGroup = group; } }
/// <summary> /// Display the specified explorer bar group and hide all others - this is generally called as a result /// of clicking on the ribbon which is how we select which administration group to display. If we do not /// currently have an active item in the group then we will select the first /// </summary> /// <param name="groupName"></param> protected void DisplayGroup(string groupName) { // Save the name of the current active group just in case we need to reset if (administrationExplorerBar.ActiveGroup != null) { activeGroupName = administrationExplorerBar.ActiveGroup.Key; } // Ensure that only the specified group is visible foreach (UltraExplorerBarGroup group in administrationExplorerBar.Groups) { group.Visible = (group.Key == groupName); } // Find the group with the specified name and make it active UltraExplorerBarGroup requiredGroup = administrationExplorerBar.Groups[groupName]; if (requiredGroup != null) { // ...and select this group requiredGroup.Selected = true; // ...and make it active this.administrationExplorerBar.ActiveGroup = requiredGroup; } }
/// <summary> /// Hides the smart part. /// </summary> protected virtual void OnHide(Control smartPart) { UltraExplorerBarGroup group = this.composer[smartPart]; if (null != group) { group.Visible = false; } }
/// <summary> /// Activates the smart part within the workspace. /// </summary> /// <param name="smartPart">The smart part to activate</param> protected virtual void OnActivate(Control smartPart) { UltraExplorerBarGroup group = this.composer[smartPart]; group.Visible = true; group.EnsureGroupInView(); group.Selected = true; group.Active = true; smartPart.Focus(); }
public void Add(ExplorerBarTreeItem item) { object obj2 = null; if (this.m_Parent is UltraExplorerBar) { UltraExplorerBarGroup group = new UltraExplorerBarGroup { Text = item.Text }; ((UltraExplorerBar)this.m_Parent).Groups.Add(group); obj2 = group; } else if (this.m_Parent is UltraExplorerBarGroup) { UltraExplorerBarGroup parent = this.m_Parent as UltraExplorerBarGroup; if (item.IsTreeGroup) { UltraExplorerBarContainerControl control = new UltraExplorerBarContainerControl(); parent.Container = control; parent.Settings.Style = GroupStyle.ControlContainer; parent.ExplorerBar.Controls.Add(control); UltraTree tree = new UltraTree { Dock = DockStyle.Fill, ImageList = parent.ExplorerBar.ImageListSmall }; control.Controls.Add(tree); UltraTreeNode node = new UltraTreeNode { Text = item.Text }; tree.Nodes.Add(node); obj2 = node; } else { UltraExplorerBarItem item2 = new UltraExplorerBarItem { Text = item.Text }; parent.Items.Add(item2); obj2 = item2; } } else if (this.m_Parent is UltraTree) { UltraTree tree2 = this.m_Parent as UltraTree; UltraTreeNode node2 = new UltraTreeNode { Text = item.Text }; tree2.Nodes.Add(node2); obj2 = node2; } item.Control = obj2; this.m_List.Add(item); }
public static Mode GroupsBuilder(UltraExplorerBar exBar) { var startMode = new Mode(); exBar.Groups.Clear(); var modeGroup = new UltraExplorerBarGroup() {Text = "Modes"}; var modes = DataHelper.GetModes(); var modeCnt = 0; foreach (var mode in modes) { if(modeCnt++ == 0) { startMode.ModeID = mode.ModeID; startMode.ModeName = mode.ModeName; } var modeItem = modeGroup.Items.Add("M" + mode.ModeID.ToString(), mode.ModeName); modeItem.Tag = mode.ModeID; } exBar.Groups.Add(modeGroup); var stateGroup = new UltraExplorerBarGroup() {Text = "States"}; var states = DataHelper.GetStates(); foreach (var state in states) { var stateItem = stateGroup.Items.Add("S" + state.StateID.ToString(), state.StateName); stateItem.Tag = state.StateID; } exBar.Groups.Add(stateGroup); var eventGroup = new UltraExplorerBarGroup() {Text = "Events"}; var events = DataHelper.GetEvents(); foreach (var myEvent in events) { var eventItem = eventGroup.Items.Add("S" + myEvent.EventID.ToString(), myEvent.EventName); eventItem.Tag = myEvent.EventID; } exBar.Groups.Add(eventGroup); var functionGroup = new UltraExplorerBarGroup() { Text = "Functions" }; var functionList = FSMFunctionLoader.GetFunctionList(); var functions = DataHelper.GetFunctions(functionList); foreach (var function in functions) { var functionItem = functionGroup.Items.Add("S" + function.FunctionID.ToString(), function.FunctionName); functionItem.Tag = function.FunctionID; } exBar.Groups.Add(functionGroup); return startMode; }
void explorerWorkspace_SelectedGroupChanging(object sender, CancelableGroupEventArgs e) { this.Cursor = Cursors.WaitCursor; // hide all the explorer groups except for the one just selected for (int i = 0; i <= explorerWorkspace.Groups.Count - 1; i++) { UltraExplorerBarGroup group = explorerWorkspace.Groups[i]; if (group != e.Group) { group.Visible = false; } } this.Cursor = Cursors.Default; }
private void ApplySmartPartInfoHelper(UltraExplorerBarGroup group, UltraExplorerBarSmartPartInfo smartPartInfo) { group.Text = smartPartInfo.Title; group.ToolTipText = smartPartInfo.Description; Image img = smartPartInfo.Image; if (img != null) { group.Settings.AppearancesSmall.HeaderAppearance.Image = img; } else if (group.Settings.HasAppearancesSmall && group.Settings.AppearancesSmall.HasHeaderAppearance) { group.Settings.AppearancesSmall.HeaderAppearance.Image = null; } }
private void CreateGroupTree(WorkItem workItem, UICommandDefinition entry) { UltraExplorerBarGroup uiElement = new UltraExplorerBarGroup { Text = entry.Text }; uiElement.Settings.Style = GroupStyle.ControlContainer; workItem.UIExtensionSites[entry.Site].Add <UltraExplorerBarGroup>(uiElement); UltraTree tree = new UltraTree { Dock = DockStyle.Fill, ImageList = uiElement.ExplorerBar.ImageListSmall }; uiElement.Container.Controls.Add(tree); workItem.UIExtensionSites.RegisterSite(entry.Site + "." + entry.Name, tree.Nodes); }
private void InitUI() { #region ExplorerBar // activate the first group and then activate the first item in that group. UltraExplorerBarGroup group = this.ultraExplorerBar1.Groups["Sales"]; if (group != null) { group.Active = true; group.Selected = true; UltraExplorerBarItem item = group.Items["Customers"]; if (item != null) { item.Active = true; this.ultraExplorerBar1.PerformAction(UltraExplorerBarAction.ClickActiveItem); } } #endregion // ExplorerBar #region AboutControl // setup the about control. Control control = new AboutControl(); control.Visible = false; control.Parent = this; ((Infragistics.Win.UltraWinToolbars.PopupControlContainerTool) this.ultraToolbarsManager1.Tools["pccAbout"]).Control = control; #endregion // AboutControl #region StatusBar #region ProgressBar // setup a timer to show progress during certain operations that could be time consuming. progressTimer = Infragistics.Win.Utilities.CreateTimer(); progressTimer.Interval = 250; progressTimer.Tick += progressTimer_Tick; progressTimer.Start(); #endregion // ProgressBar #region TrackBar // if there is a Midpoint defined set the value of the trackbar to the midpoint value. if (this.ultraTrackBar1.MidpointSettings.Value.HasValue) { this.ultraTrackBar1.Value = this.ultraTrackBar1.MidpointSettings.Value.Value; } #endregion // TrackBar #endregion // StatusBar }
protected void SelectFirstItem(UltraExplorerBarGroup group) { // If there is an ActiveGroup set, set the ActiveItem to the first item within the ActiveGroup. if (this.administrationExplorerBar.ActiveGroup != null && this.administrationExplorerBar.ActiveGroup.Items.Count > 0) { this.administrationExplorerBar.ActiveItem = this.administrationExplorerBar.ActiveGroup.Items[0]; return; } // If there is an ActiveItem set, set the ActiveGroup to the group containing the item. if (this.administrationExplorerBar.ActiveItem != null) { this.administrationExplorerBar.ActiveGroup = this.administrationExplorerBar.ActiveItem.Group; return; } }
public AdministrationExplorerView([ServiceDependency] WorkItem workItem) { this.workItem = workItem as LaytonWorkItem; InitializeComponent(); // Set up a paint handler to display the ghosted image this.Paint += new PaintEventHandler(administrationExplorerBar_Paint); // Create an appearance so that we can show which is the selected item this.selectedItemAppearance = new Infragistics.Win.Appearance(); this.selectedItemAppearance.BackColor = SystemColors.MenuHighlight; this.selectedItemAppearance.ForeColor = SystemColors.HighlightText; // Ensure that initially the 'General' group is the only one displayed UltraExplorerBarGroup generalGroup = this.administrationExplorerBar.Groups[GeneralOptionNames.generalGroup]; DisplayGroup(GeneralOptionNames.generalGroup); }
/// <summary> /// Update the values specified for the Asset Statistics /// </summary> private void UpdateAssetStatistics() { // Get the current statistics StatisticsDAO awDataAccess = new StatisticsDAO(); DataTable statisticsTable = awDataAccess.AssetStatistics(); // Into an object for easier viewing AssetStatistics statistics = new AssetStatistics(statisticsTable.Rows[0]); // Update the Computer Statistics Explorer Bar // Total, audited, not audited, stoc, in use ,pending, disposed // UltraExplorerBarGroup assetStatistics = overviewExplorerBar.Groups["assetstatistics"]; if (assetStatistics == null) { return; } assetStatistics.Items["numberindatabase"].Text = StatisticTitles.ComputersDiscovered + statistics.Discovered.ToString(); assetStatistics.Items["computersaudited"].Text = StatisticTitles.ComputersAudited + statistics.Audited.ToString(); if (statistics.MostRecentAudit.Ticks == 0) { assetStatistics.Items["computersnotaudited"].Text = StatisticTitles.ComputerLastAudit + "No Audits Run"; } else { assetStatistics.Items["computersnotaudited"].Text = StatisticTitles.ComputerLastAudit + statistics.MostRecentAudit.ToString("dd MMM HH:mm"); } // assetStatistics.Items["assetsinstock"].Text = StatisticTitles.AssetsInStock + statistics.Stock.ToString(); assetStatistics.Items["assetsinuse"].Text = StatisticTitles.AssetsInUse + statistics.InUse.ToString(); assetStatistics.Items["assetspendingdisposal"].Text = StatisticTitles.AssetsPending + statistics.PendingDisposal.ToString(); assetStatistics.Items["assetsdisposed"].Text = StatisticTitles.AssetsDisposed + statistics.Disposed.ToString(); statisticsTable = awDataAccess.AuditStatistics(); AuditStatistics auditStatistics = new AuditStatistics(statisticsTable.Rows[0]); assetStatistics.Items["auditagentsdeployed"].Text = StatisticTitles.AgentsDeployed + auditStatistics.DeployedAgents.ToString(); }
/// <summary> /// Update the Audit History Statistics /// </summary> private void UpdateAuditHistoryStatistics() { StatisticsDAO awDataAccess = new StatisticsDAO(); DataTable statisticsTable = awDataAccess.AuditHistoryStatisticsForDashboard(); AuditHistoryStatistics statistics = new AuditHistoryStatistics(statisticsTable.Rows[0]); // Update the ApplicationID Statistics Explorer Bar UltraExplorerBarGroup auditHistory = overviewExplorerBar.Groups["audithistory"]; if (auditHistory == null) { return; } auditHistory.Items["auditedtoday"].Text = StatisticTitles.AuditedToday + statistics.AuditedToday.ToString(); auditHistory.Items["notaudited7"].Text = StatisticTitles.NotAudited7 + statistics.NotAudited7.ToString(); auditHistory.Items["notaudited14"].Text = StatisticTitles.NotAudited14 + statistics.NotAudited14.ToString(); auditHistory.Items["notaudited30"].Text = StatisticTitles.NotAudited30 + statistics.NotAudited30.ToString(); auditHistory.Items["notaudited90"].Text = StatisticTitles.NotAudited90 + statistics.NotAudited90.ToString(); auditHistory.Items["neveraudited"].Text = StatisticTitles.NotAudited + statistics.NotAudited.ToString(); }
/// <summary> /// Update the values specified for the Alert Statistics /// </summary> private void UpdateAlertStatistics() { StatisticsDAO awDataAccess = new StatisticsDAO(); DataTable statisticsTable = awDataAccess.AlertStatistics(); AlertStatistics statistics = new AlertStatistics(statisticsTable.Rows[0]); // Update the ApplicationID Statistics Explorer Bar UltraExplorerBarGroup alerts = overviewExplorerBar.Groups["alerts"]; if (alerts == null) { return; } string lastAlertDate = statistics.LastAlert.Ticks == 0 ? "<none>" : statistics.LastAlert.ToString("dd MMM HH:mm"); alerts.Items["lastalerton"].Text = StatisticTitles.LastAlert + lastAlertDate; alerts.Items["alertstoday"].Text = StatisticTitles.AlertsToday + statistics.AlertsToday.ToString(); alerts.Items["alertsthisweek"].Text = StatisticTitles.AlertsThisWeek + statistics.AlertsThisWeek.ToString(); alerts.Items["alertsthismonth"].Text = StatisticTitles.AlertsThisMonth + statistics.AlertsThisMonth.ToString(); }
/// <summary> /// Shows the smart part in the workspace. /// </summary> /// <param name="smartPart">The smart part to show</param> /// <param name="smartPartInfo">The associated smart part info for the smart part being shown.</param> protected virtual void OnShow(Control smartPart, UltraExplorerBarSmartPartInfo smartPartInfo) { // create a tab that will represent the smart part UltraExplorerBarGroup group = new UltraExplorerBarGroup(); group.Settings.Style = GroupStyle.ControlContainer; this.ApplySmartPartInfoHelper(group, smartPartInfo); // keep associations between the smart part // and group that represents it this.composer.Add(group, smartPart); // store the new group this.Groups.Add(group); // and then add the smart part control to the // tab page smartPart.Dock = DockStyle.Fill; group.Container.Controls.Add(smartPart); }
/// <summary> /// Update the License Statistics /// </summary> private void UpdateLicenseStatistics() { // Recover the total license count from the product key Layton.Cab.Interface.LaytonProductKey key = WorkItem.RootWorkItem.Items[Layton.Cab.Interface.MiscStrings.ProductKey] as Layton.Cab.Interface.LaytonProductKey; int licenseCount = (key.IsTrial) ? 10 : key.AssetCount; UltraExplorerBarGroup licenses = overviewExplorerBar.Groups["licensing"]; if (licenses == null) { return; } // Set this in the explorer bar licenses.Items["licensecount"].Text = StatisticTitles.LicensedFor + licenseCount.ToString(); // Now we need a count of the 'licensable' assets within the database - this is the number of assets // which have been audited excluding child assets and any which have been flagged as 'disposed of' AssetDAO awDataAccess = new AssetDAO(); int licensesUsed = awDataAccess.LicensedAssetCount(); licenses.Items["licensesused"].Text = StatisticTitles.LicensesUsed + licensesUsed.ToString(); }
/// <summary> /// Closes/removes the smart part. /// </summary> protected virtual void OnClose(Control smartPart) { // find the group we contained the smartpart within UltraExplorerBarGroup group = this.composer[smartPart]; // clean up the group<=>smartpart references this.composer.Remove(group, smartPart); // at design time, we won't remove the group // if you remove the first control // if (this.DesignMode == false) { // reparent the control if (smartPart.Disposing == false && smartPart.IsDisposed == false) { smartPart.Parent = null; } // get rid of the explorerbar group this.Groups.Remove(group); group.Dispose(); } }
public static void LoadItems(DataView dv, UltraExplorerBar explorerBar, UltraExplorerBarGroup explorerBarGroup) { foreach (DataRowView drv in dv) { long IdHerramienta = ( long )drv["IdHerramienta"]; string id = ( string )drv["id"]; System.Console.WriteLine(IdHerramienta); System.Console.WriteLine(id); if (HasChilds(dv.Table, IdHerramienta)) { UltraExplorerBarGroup newExplorerBarGroup = new UltraExplorerBarGroup(GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta)); newExplorerBarGroup.Text = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta); explorerBar.Groups.Add(newExplorerBarGroup); LoadItems(new DataView(dv.Table, string.Format("IdHerramientaPadre = {0}", drv["IdHerramienta"]), null, DataViewRowState.OriginalRows), explorerBar, newExplorerBarGroup); } else { UltraExplorerBarItem newExplorerBarItem = new UltraExplorerBarItem(id); newExplorerBarItem.Text = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta); if (GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta) != string.Empty) { //German 20110329 - Tarea 0000093 ImageList ilSmall = explorerBar.ImageListSmall; string prueba = string.Format( mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" + GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "16"); Image image1 = null; try { System.Drawing.Icon c = new Icon(prueba); image1 = c.ToBitmap(); } catch (Exception e) { image1 = Image.FromFile(prueba); //int smallIndexImage = ilSmall.Images.Add( Image.FromFile( prueba), System.Drawing.Color.Magenta ); } int smallIndexImage = ilSmall.Images.Add(image1, System.Drawing.Color.Magenta); ImageList ilLarge = explorerBar.ImageListLarge; prueba = string.Format( mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" + GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "24"); //int largeIndexImage = ilLarge.Images.Add(Image.FromFile(prueba), System.Drawing.Color.Magenta); try { System.Drawing.Icon c = new Icon(prueba); image1 = c.ToBitmap(); } catch (Exception e) { image1 = Image.FromFile(prueba); //int smallIndexImage = ilSmall.Images.Add( Image.FromFile( prueba), System.Drawing.Color.Magenta ); } int largeIndexImage = ilLarge.Images.Add(image1, System.Drawing.Color.Magenta); //Fin German 20110329 - Tarea 0000093 newExplorerBarItem.Settings.AppearancesSmall.Appearance.Image = smallIndexImage; newExplorerBarItem.Settings.AppearancesLarge.Appearance.Image = largeIndexImage; } try { explorerBarGroup.Items.Add(newExplorerBarItem); } catch {} } } }
/// <summary> /// Saves a UltraExplorerBar using the provided Preferences store. /// </summary> /// <param name="explorerBar">UltraExplorerBar</param> /// <param name="store">Settings</param> /// <param name="preferenceId">String. The ID the settings should come from /// (multiple sets may exist in the Preference store)</param> /// <exception cref="ArgumentNullException">If any of the parameters is null</exception> /// <exception cref="InvalidOperationException">If the collection of groups allow duplicate keys /// or any group does not have a unique key</exception> internal static void SaveExplorerBar(UltraExplorerBar explorerBar, UiStateSettings store, string preferenceId) { if (explorerBar == null) { throw new ArgumentNullException("explorerBar"); } if (store == null) { throw new ArgumentNullException("store"); } if (string.IsNullOrEmpty(preferenceId)) { throw new ArgumentNullException("preferenceId"); } if (explorerBar.Groups.AllowDuplicateKeys) { throw new InvalidOperationException("UltraExplorerBarGroupsCollection must provide unique Keys to support Load/Save settings operations."); } // explorerBar.SaveAsXml(@"D:\expl.xml"); // return; Preferences prefWriter = store.GetSubnode(preferenceId); prefWriter.SetProperty("version", 1); // make the impl. extendable prefWriter.SetProperty("Location.X", explorerBar.Location.X); prefWriter.SetProperty("Location.Y", explorerBar.Location.Y); prefWriter.SetProperty("Size.Width", explorerBar.Size.Width); prefWriter.SetProperty("Size.Height", explorerBar.Size.Height); prefWriter.SetProperty("MaxGroupHeaders", explorerBar.NavigationMaxGroupHeaders); // no groups: nothing more to write if (explorerBar.Groups.Count == 0) { prefWriter.SetProperty("groupOrder", null); return; } // build/write the order array: prefWriter.SetProperty("groupOrder", GetKeyOrderArray(explorerBar.Groups, ";")); for (int i = 0; i < explorerBar.Groups.Count; i++) { UltraExplorerBarGroup group = explorerBar.Groups[i]; string key = String.Format("group.{0}", i); if (group.Key != null && group.Key.Length > 0) { key = String.Format("group.{0}", group.Key); } if (group.Selected) { prefWriter.SetProperty("selected", key); } prefWriter.SetProperty(String.Format("{0}.Visible", key), group.Visible); } }
public ContextMenuHelper() { Item = null; Group = null; }
/// <summary> /// Load up the Explorer Bar from the DB. /// </summary> public void LoadData() { string ssd = DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek).Date.ToString("yyyyMMdd"); // Get all checkmark data for this week and this site DataTable dtItemChecks = VWA4Common.DB.Retrieve("SELECT * FROM TaskStates WHERE (Format(WeekStartDate, 'yyyymmdd') = " + ssd + ") AND (SiteID=" + VWA4Common.GlobalSettings.CurrentSiteID.ToString() + ");" ); ultraExplorerBar1.Groups.Clear(); // Assume the DB table is properly initialized // // Add Groups and Items (for those Groups that we find) // DataTable dtGroups = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = 0 ORDER BY Rank"); foreach (DataRow row in dtGroups.Rows) { if (bool.Parse(row["Enabled"].ToString())) { // Add the next group UltraExplorerBarGroup aGroup = new UltraExplorerBarGroup(); aGroup = ultraExplorerBar1.Groups.Add(); aGroup.Text = row["DisplayName"].ToString(); string sssss = row["UniqueName"].ToString(); aGroup.Expanded = bool.Parse(row["Expanded"].ToString()); aGroup.Key = sssss; int gpid = (int)row["ID"]; // Add Items under this Group DataTable dtItems = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = " + gpid.ToString() + " ORDER BY Rank"); foreach (DataRow irow in dtItems.Rows) { if (bool.Parse(irow["Enabled"].ToString())) { // This item is enabled - add it UltraExplorerBarItem anItem = new UltraExplorerBarItem(); anItem.Text = irow["DisplayName"].ToString(); anItem.Key = irow["UniqueName"].ToString(); anItem.Checked = false; // initialize // Check DB to see if this item is checked foreach (DataRow icrow in dtItemChecks.Rows) { // Do we have an entry that matches the current item? //int icrowtest = (int)icrow["TaskID"]; //int irowtest = (int)irow["ID"]; if (icrow["TaskUniqueName"].ToString() == irow["UniqueName"].ToString()) { // There is a task item check entry for this item anItem.Checked = (bool)icrow["TaskChecked"]; } } if (anItem.Checked) { anItem.Settings.AppearancesSmall.Appearance.Image = 1; } else { anItem.Settings.AppearancesSmall.Appearance.Image = 0; } // Is this item the current task? aGroup.Items.Add(anItem); } else { // This item is not enabled - don't add it } } } } this.ultraExplorerBar1.Update(); }
private void WfLoadMenu() { StringBuilder sbSql; DataTable dtAdm; Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarContainerControl uebcc; Infragistics.Win.UltraWinTree.UltraTree ut; ImageList imgModules; string imgModuleKey; try { imgModules = YR.Util.GlobalPictuer.LoadModuleImage(); sbSql = new StringBuilder(); sbSql.AppendLine("SELECT * FROM adm_tb"); sbSql.AppendLine("LEFT JOIN ado_tb ON adm02=ado01"); sbSql.AppendLine("WHERE adm01='menu'"); sbSql.AppendLine(" AND ado07='M'"); sbSql.AppendLine("ORDER BY adm03"); dtAdm = BoSecurity.OfGetDataTable(sbSql.ToString(), null); if (dtAdm == null || dtAdm.Rows.Count == 0) { return; } var i = 0; foreach (DataRow drAdm in dtAdm.Rows) { UltraExplorerBarGroup uebg = new UltraExplorerBarGroup(); uebcc = new UltraExplorerBarContainerControl(); ut = new UltraTree(); ut.BorderStyle = Infragistics.Win.UIElementBorderStyle.None; ut.ShowLines = true; //ut.Appearance.BackColor = GetStyleLibrary.TreeBackGroundColor; ut.ImageList = ImgList; //ut.Font = new Font(ut.Font.FontFamily, 11); ut.Font = GetStyleLibrary.FontControlNormal; ut.DoubleClick += new EventHandler(UltraTree_DoubleClick); ut.AfterActivate += ut_AfterActivate; ut.KeyDown += new System.Windows.Forms.KeyEventHandler(UltraTree_KeyDown); uebg.Key = drAdm["adm02"].ToString(); uebg.Text = drAdm["ado02"].ToString(); if (i == 0)//第一筆時要顯示流程圖 { WfShowFlowByAdo01(uebg.Key); } uebg.Settings.Style = Infragistics.Win.UltraWinExplorerBar.GroupStyle.ControlContainer; UebMenu.Groups.Add(uebg); //設定header圖檔,先簡單處理 imgModuleKey = "module_" + uebg.Key + "_32"; try { uebg.Settings.AppearancesSmall.HeaderAppearance.Image = imgModules.Images[imgModuleKey]; } catch { } WfloadTree(uebg.Key, ut, null); if (ut != null) { uebg.Container = uebcc; uebg.Settings.ItemAreaInnerMargins.Bottom = 0; uebg.Settings.ItemAreaInnerMargins.Left = 0; uebg.Settings.ItemAreaInnerMargins.Right = 0; uebg.Settings.ItemAreaInnerMargins.Top = 0; uebg.Settings.ItemAreaOuterMargins.Bottom = 5; uebg.Settings.ItemAreaOuterMargins.Left = 5; uebg.Settings.ItemAreaOuterMargins.Right = 5; uebg.Settings.ItemAreaOuterMargins.Top = 5; ut.Dock = DockStyle.Fill; uebcc.Controls.Add(ut); UebMenu.Controls.Add(uebcc); UebMenu.Groups[0].ExplorerBar.Appearance.BackColor = Color.Red; } i++; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Applies the smart part info to the smart part within the workspace. /// </summary> /// <param name="smartPart">The smart part to which the smart part info should be applied.</param> /// <param name="smartPartInfo">The smart part info to apply</param> protected virtual void OnApplySmartPartInfo(Control smartPart, UltraExplorerBarSmartPartInfo smartPartInfo) { UltraExplorerBarGroup group = this.composer[smartPart]; this.ApplySmartPartInfoHelper(group, smartPartInfo); }
/// <summary> /// Returns the index at which an group will be added. /// </summary> /// <param name="group">Group to evaluate</param> /// <returns>By default, groups are added at the end of the associated <see cref="Groups"/> collection.</returns> protected override int GetNewElementIndex(UltraExplorerBarGroup group) { return(this.Groups.IndexOf(this.group) + 1); }
/// /// Task Bar Setup /// private void LoadTaskBarData() { ultraExplorerBar1.Groups.Clear(); // Assume the DB table is properly initialized // // Add Groups and Items (for those Groups that we find) // DataTable dtGroups = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = 0 ORDER BY Rank"); foreach (DataRow row in dtGroups.Rows) { // Add the next group UltraExplorerBarGroup aGroup = new UltraExplorerBarGroup(); aGroup = ultraExplorerBar1.Groups.Add(); aGroup.Text = row["DisplayName"].ToString(); string sssss = row["UniqueName"].ToString(); bool grpenabled = bool.Parse(row["Enabled"].ToString()); //aGroup.Expanded = bool.Parse(row["Expanded"].ToString()); aGroup.Key = sssss; aGroup.Settings.AllowDrag = Infragistics.Win.DefaultableBoolean.True; int gpid = (int)row["ID"]; aGroup.Tag = new mGroupItemTag(gpid, sssss, int.Parse(row["ParentID"].ToString()), int.Parse(row["Rank"].ToString()), bool.Parse(row["Expanded"].ToString()), grpenabled); // Add Items under this Group DataTable dtItems = VWA4Common.DB.Retrieve("SELECT * FROM TaskItems WHERE ParentID = " + gpid.ToString() + " ORDER BY Rank"); foreach (DataRow irow in dtItems.Rows) { UltraExplorerBarItem anItem = new UltraExplorerBarItem(); anItem.Checked = bool.Parse(irow["Enabled"].ToString()); if ((!anItem.Checked && ((int.Parse(VWA4Common.GlobalSettings.HideDisabledTasks) == 2) && !VWA4Common.GlobalSettings.IsSuper)) || !anItem.Checked && ((int.Parse(VWA4Common.GlobalSettings.HideDisabledTasks) == 1) && (!VWA4Common.GlobalSettings.IsLogged && !VWA4Common.GlobalSettings.IsSuper)) ) { /// NOT going to show this task to the current user // So just don't add it } else { /// AM going to show this task to the current user anItem.Text = irow["DisplayName"].ToString(); anItem.Key = irow["UniqueName"].ToString(); anItem.Settings.AllowDragMove = ItemDragStyle.WithinAndAcrossGroups; if (anItem.Checked) { anItem.Settings.AppearancesSmall.Appearance.Image = 1; } else { anItem.Settings.AppearancesSmall.Appearance.Image = 0; } anItem.Tag = new mGroupItemTag(int.Parse(irow["ID"].ToString()), anItem.Key, int.Parse(irow["ParentID"].ToString()), int.Parse(irow["Rank"].ToString()), bool.Parse(irow["Expanded"].ToString()), anItem.Checked); // Add the Item to its group aGroup.Items.Add(anItem); } } if (grpenabled) { aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.False; aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True; } else { aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.True; aGroup.Settings.AppearancesSmall.HeaderAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.False; } } ultraExplorerBar1.Groups.ExpandAll(); ultraExplorerBar1.ActiveItem = null; this.ultraExplorerBar1.Update(); }
private void ultraExplorerBar1_GroupClick(object sender, GroupEventArgs e) { UltraExplorerBarGroup anGroup = e.Group; mGroupItemTag tag = (mGroupItemTag)anGroup.Tag; string sql = ""; try { // First need to make sure the user can change this Group if (VWA4Common.GlobalSettings.IsSuper || VWA4Common.GlobalSettings.IsLogged) { if (anGroup.Items.Count == 0) { if (MessageBox.Show("No Tasks under this Group - Remove this Group permanently from the Task Bar?", "No Tasks in Group", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // Delete the Group sql = "DELETE FROM TaskItems WHERE ID=" + tag.ID + ";"; VWA4Common.DB.Delete(sql); /// Update the local Taskbar LoadTaskBarData(); /// Update the real Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); return; } } // If we get here, user just wants to rename the Group /// allow the current user to rename this Group /// Get current enabled setting sql = "SELECT * FROM TaskItems WHERE (ParentID = 0) AND UniqueName = '" + e.Group.Key + "';"; DataTable dtGroups = VWA4Common.DB.Retrieve(sql); DataRow irow = dtGroups.Rows[0]; bool enablesetting = bool.Parse(irow["Enabled"].ToString()); int grpID = int.Parse(irow["ID"].ToString()); /// Text was clicked, so change the name VWA4Common.DialogGet1LineofText dtb = new VWA4Common.DialogGet1LineofText( "Please type in the new Task Group Name below:", e.Group.Text, "Change Task Group Name", enablesetting, "Show Group in Task Bar"); if (dtb.ShowDialog() == DialogResult.OK) { e.Group.Text = dtb.sNewText; bool grpenabled = dtb.bNewEnabled; dtb.Dispose(); if (grpenabled) { e.Group.Settings.AppearancesSmall.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.False; } else { e.Group.Settings.AppearancesSmall.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.True; } // Update database with new name sql = "UPDATE TaskItems SET DisplayName = '" + e.Group.Text + "', Uniquename = '" + e.Group.Text.ToLower() + "', Enabled = " + grpenabled.ToString() + " WHERE ID = " + grpID.ToString() + ";"; VWA4Common.DB.Update(sql); if (!grpenabled) { sql = "UPDATE TaskItems SET Enabled = false WHERE ParentID = " + grpID.ToString() + ";"; VWA4Common.DB.Update(sql); } /// Update the local Taskbar LoadTaskBarData(); /// Update the real Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); } } else { /// disallow the current user from checking or unchecking this Group } } finally { LoadTaskBarData(); } }