private void AddNoResultsRow() { GridRow row = new GridRow(ROW_HEIGHT); GridStringItem resultsItem = new GridStringItem(Messages.OVERVIEW_NO_RESULTS, HorizontalAlignment.Left, VerticalAlignment.Middle, false, false, TextBrush, Program.DefaultFont, 6); row.AddItem("name", resultsItem); AddRow(row); }
private static void AddCustomFieldsToRow(IXenObject o, GridRow row) { foreach (CustomFieldDefinition customFieldDefinition in CustomFieldsManager.GetCustomFields()) { GridStringItem customFieldItem = new GridStringItem( new CustomFieldWrapper(o, customFieldDefinition), HorizontalAlignment.Center, VerticalAlignment.Middle, false, false, TextBrush, Program.DefaultFont, new EventHandler(delegate { PropertiesDialog dialog = new PropertiesDialog(o); dialog.SelectPage(dialog.CustomFieldsEditPage); dialog.ShowDialog(); })); row.AddItem(CustomFieldsManager.CUSTOM_FIELD + customFieldDefinition.Name, customFieldItem); } }
private static GridRow CreateRow(Grouping grouping, Object o, int indent) { IXenObject ixmo = o as IXenObject; if (ixmo != null) { bool isFolderRow = (o is Folder); GridRow _row = NewGroupRow(ixmo.opaque_ref, ixmo, isFolderRow ? FOLDER_ROW_HEIGHT : ROW_HEIGHT, 0); foreach (ColumnNames column in Enum.GetValues(typeof(ColumnNames))) { GridItemBase item = ColumnAccessors.Get(column).GetGridItem(ixmo); if (item != null) { if (column == XenAdmin.XenSearch.ColumnNames.name) { EventHandler onDoubleClickDelegate = isFolderRow ? (EventHandler) delegate { Program.MainWindow.DoSearch(Search.SearchForFolder(ixmo.opaque_ref)); } : (EventHandler) delegate { if (Program.MainWindow.SelectObject(ixmo) && Program.MainWindow.TheTabControl.TabPages.Contains(Program.MainWindow.TabPageGeneral)) { Program.MainWindow.SwitchToTab(MainWindow.Tab.Settings); } }; GridImageItem _statusItem = new GridImageItem( "foo", new ImageDelegate(delegate() { return(Images.GetImage16For(ixmo)); }), HorizontalAlignment.Left, VerticalAlignment.Top, true, onDoubleClickDelegate); _row.AddItem("name", NewNameItem(_statusItem, item, 16, indent)); } else { _row.AddItem(column.ToString(), item); } } } AddCustomFieldsToRow(ixmo, _row); return(_row); } if (grouping == null) { return(null); } GridRow row = NewGroupRow(String.Format("{0}: {1}", grouping.GroupingName, o), null, ROW_HEIGHT, 0); GridImageItem statusItem = new GridImageItem( grouping.GroupingName, new ImageDelegate(delegate() { return(Images.GetImage16For(grouping.GetGroupIcon(o))); }), HorizontalAlignment.Left, VerticalAlignment.Top, true); GridVerticalArrayItem nameItem = NewDoubleRowItem(grouping, o); row.AddItem("name", NewNameItem(statusItem, nameItem, 16, indent)); return(row); }
private static void AddCustomFieldsToRow(IXenObject o, GridRow row) { foreach (CustomFieldDefinition customFieldDefinition in CustomFieldsManager.GetCustomFields()) { GridStringItem customFieldItem = new GridStringItem( new CustomFieldWrapper(o, customFieldDefinition), HorizontalAlignment.Center, VerticalAlignment.Middle, false, false, TextBrush, Program.DefaultFont, new EventHandler(delegate { using (PropertiesDialog dialog = new PropertiesDialog(o)) { dialog.SelectCustomFieldsEditPage(); dialog.ShowDialog(); } })); row.AddItem(CustomFieldsManager.CUSTOM_FIELD + customFieldDefinition.Name, customFieldItem); } }
/// <summary> /// Initialize the starting state of the settings pages for the HomeSeerSamplePlugin. /// This constructs the framework that the user configurable settings for the plugin live in. /// Any saved configuration options are loaded later in <see cref="Initialize"/> using /// <see cref="AbstractPlugin.LoadSettingsFromIni"/> /// </summary> /// <remarks> /// For ease of use throughout the plugin, all of the view IDs, names, and values (non-volatile data) /// are stored in the <see cref="HSPI_HomeSeerSamplePlugin.Constants.Settings"/> static class. /// </remarks> private void InitializeSettingsPages() { //Initialize the first settings page // This page is used to manipulate the behavior of the sample plugin //Start a PageFactory to construct the Page var settingsPage1 = PageFactory.CreateSettingsPage(Constants.Settings.SettingsPage1Id, Constants.Settings.SettingsPage1Name); //Add a LabelView to the page settingsPage1.WithLabel(Constants.Settings.Sp1ColorLabelId, null, Constants.Settings.Sp1ColorLabelValue); //Create a group of ToggleViews displayed as a flexbox grid var colorViewGroup = new GridView(Constants.Settings.Sp1ColorGroupId, Constants.Settings.Sp1ColorGroupName); var colorFirstRow = new GridRow(); colorFirstRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleRedId, Constants.Settings.ColorRedName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); colorFirstRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleOrangeId, Constants.Settings.ColorOrangeName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); colorFirstRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleYellowId, Constants.Settings.ColorYellowName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); colorFirstRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleGreenId, Constants.Settings.ColorGreenName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); var colorSecondRow = new GridRow(); colorSecondRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleBlueId, Constants.Settings.ColorBlueName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); colorSecondRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleIndigoId, Constants.Settings.ColorIndigoName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); colorSecondRow.AddItem(new ToggleView(Constants.Settings.Sp1ColorToggleVioletId, Constants.Settings.ColorVioletName, true) { ToggleType = EToggleType.Checkbox }, extraSmallSize: EColSize.Col6, largeSize: EColSize.Col3); colorViewGroup.AddRow(colorFirstRow); colorViewGroup.AddRow(colorSecondRow); //Add the ViewGroup containing all of the ToggleViews to the page settingsPage1.WithView(colorViewGroup); //Create 2 ToggleViews for controlling the visibility of the other two settings pages var pageToggles = new List <ToggleView> { new ToggleView(Constants.Settings.Sp1PageVisToggle1Id, Constants.Settings.Sp1PageVisToggle1Name, true), new ToggleView(Constants.Settings.Sp1PageVisToggle2Id, Constants.Settings.Sp1PageVisToggle2Name, true), }; //Add a ViewGroup containing all of the ToggleViews to the page settingsPage1.WithGroup(Constants.Settings.Sp1PageToggleGroupId, Constants.Settings.Sp1PageToggleGroupName, pageToggles); //Add the first page to the list of plugin settings pages Settings.Add(settingsPage1.Page); //Initialize the second settings page // This page is used to visually demonstrate all of the available JUI views except for InputViews. // None of these views interact with the plugin and are merely for show. //Start a PageFactory to construct the Page var settingsPage2 = PageFactory.CreateSettingsPage(Constants.Settings.SettingsPage2Id, Constants.Settings.SettingsPage2Name); //Add a LabelView with a title to the page settingsPage2.WithLabel(Constants.Settings.Sp2LabelWTitleId, Constants.Settings.Sp2LabelWTitleName, Constants.Settings.Sp2LabelWTitleValue); //Add a LabelView without a title to the page settingsPage2.WithLabel(Constants.Settings.Sp2LabelWoTitleId, null, Constants.Settings.Sp2LabelWoTitleValue); //Add a toggle switch to the page settingsPage2.WithToggle(Constants.Settings.Sp2SampleToggleId, Constants.Settings.Sp2SampleToggleName); //Add a checkbox to the page settingsPage2.WithCheckBox(Constants.Settings.Sp2SampleCheckBoxId, Constants.Settings.Sp2SampleCheckBoxName); //Add a drop down select list to the page settingsPage2.WithDropDownSelectList(Constants.Settings.Sp2SelectListId, Constants.Settings.Sp2SelectListName, Constants.Settings.Sp2SelectListOptions); //Add a radio select list to the page settingsPage2.WithRadioSelectList(Constants.Settings.Sp2RadioSlId, Constants.Settings.Sp2RadioSlName, Constants.Settings.Sp2SelectListOptions); //Add a text area to the page settingsPage2.WithTextArea(Constants.Settings.Sp2TextAreaId, Constants.Settings.Sp2TextAreaName, 3); //Add a time span to the page settingsPage2.WithTimeSpan(Constants.Settings.Sp2SampleTimeSpanId, Constants.Settings.Sp2SampleTimeSpanName); //Add the second page to the list of plugin settings pages Settings.Add(settingsPage2.Page); //Initialize the third settings page // This page is used to visually demonstrate the different types of JUI InputViews. //Start a PageFactory to construct the Page var settingsPage3 = PageFactory.CreateSettingsPage(Constants.Settings.SettingsPage3Id, Constants.Settings.SettingsPage3Name); //Add a text InputView to the page settingsPage3.WithInput(Constants.Settings.Sp3SampleInput1Id, Constants.Settings.Sp3SampleInput1Name); //Add a number InputView to the page settingsPage3.WithInput(Constants.Settings.Sp3SampleInput2Id, Constants.Settings.Sp3SampleInput2Name, EInputType.Number); //Add an email InputView to the page settingsPage3.WithInput(Constants.Settings.Sp3SampleInput3Id, Constants.Settings.Sp3SampleInput3Name, EInputType.Email); //Add a URL InputView to the page settingsPage3.WithInput(Constants.Settings.Sp3SampleInput4Id, Constants.Settings.Sp3SampleInput4Name, EInputType.Url); //Add a password InputView to the page settingsPage3.WithInput(Constants.Settings.Sp3SampleInput5Id, Constants.Settings.Sp3SampleInput5Name, EInputType.Password); //Add a decimal InputView to the page settingsPage3.WithInput(Constants.Settings.Sp3SampleInput6Id, Constants.Settings.Sp3SampleInput6Name, EInputType.Decimal); //Add the third page to the list of plugin settings pages Settings.Add(settingsPage3.Page); }