private BarEditItem CreateBarEditItem(TextEntryActionItem item)
        {
            var guiItem = new BarEditItem();

            guiItem.Name    = item.Key;
            guiItem.Caption = item.Caption;

            RepositoryItemTextEdit textBox = new RepositoryItemTextEdit();

            guiItem.Edit = textBox;

            if (item.Width != 0)
            {
                guiItem.Width = item.Width;
            }

            if (!item.Enabled)
            {
                guiItem.Enabled = false;
            }

            textBox.EditValueChanged += delegate(object sender, System.EventArgs e)
            {
                var edit = sender as DevExpress.XtraEditors.TextEdit;
                item.PropertyChanged -= TextEntryActionItem_PropertyChanged;
                item.Text             = edit.Text;
                item.PropertyChanged += TextEntryActionItem_PropertyChanged;
            };

            return(guiItem);
        }
Beispiel #2
0
        private void ribbonTextBox_textChanged(TextEntryActionItem textbox)
        {
            //get path from ribbon textbox
            string path = textbox.Text;

            //replace path slashes
            path = path.Replace('/', '\\');

            //update file list
            hydroModelerControl.filelist_update(path);
        }
        /// <summary>
        /// Adds the specified textbox item.
        /// </summary>
        /// <param name="item">The item.</param>
        public override void Add(TextEntryActionItem item)
        {
            Guard.ArgumentNotNull(item, "item");

            RibbonPage      page  = this.GetRibbonPage(item);
            RibbonPageGroup group = GetOrCreateGroup(
                page, item.GroupCaption ?? this.GetProductName(Assembly.GetCallingAssembly()));

            var newItem = this.CreateBarEditItem(item);


            ProcessSeperator(group.ItemLinks.Add(newItem));

            item.PropertyChanged += new PropertyChangedEventHandler(TextEntryActionItem_PropertyChanged);
        }
        public override void Add(TextEntryActionItem item)
        {
            var textBox = new TextBox {
                Name = item.Key
            };

            if (item.Width != 0)
            {
                textBox.Width = item.Width;
            }
            textBox.TextChanged += delegate
            {
                item.PropertyChanged -= TextEntryActionItem_PropertyChanged;
                item.Text             = textBox.Text;
                item.PropertyChanged += TextEntryActionItem_PropertyChanged;
            };
            container.Controls.Add(textBox);
            item.PropertyChanged += TextEntryActionItem_PropertyChanged;
        }
Beispiel #5
0
        //private void AddMapButtons()
        //{
        //    string kHomeRoot = kHydroSearch3;
        //    string rpMapTools = "Map Tools";
        //    string kHydroMapTools = "kHydroMapToolsSearch";
        //    var head = App.HeaderControl;

        //    //Pan
        //    var _rbPan = new SimpleActionItem(kHomeRoot, "Pan", rbPan_Click);
        //    _rbPan.GroupCaption = rpMapTools;
        //    _rbPan.LargeImage = Properties.Resources.pan;
        //    _rbPan.SmallImage = Properties.Resources.pan_16;
        //    _rbPan.ToolTipText = "Pan - Move the Map";
        //    _rbPan.ToggleGroupKey = kHydroMapTools;
        //    head.Add(_rbPan);

        //    //ZoomIn
        //    var _rbZoomIn = new SimpleActionItem(kHomeRoot, "Zoom In", rbZoomIn_Click);
        //    _rbZoomIn.ToolTipText = "Zoom In";
        //    _rbZoomIn.GroupCaption = rpMapTools;
        //    _rbZoomIn.LargeImage = Properties.Resources.zoom_in;
        //    _rbZoomIn.SmallImage = Properties.Resources.zoom_in_16;
        //    _rbZoomIn.ToggleGroupKey = kHydroMapTools;
        //    head.Add(_rbZoomIn);

        //    //ZoomOut
        //    var _rbZoomOut = new SimpleActionItem(kHomeRoot, "Zoom Out", rbZoomOut_Click);
        //    _rbZoomOut.ToolTipText = "Zoom Out";
        //    _rbZoomOut.GroupCaption = rpMapTools;
        //    _rbZoomOut.LargeImage = Properties.Resources.zoom_out;
        //    _rbZoomOut.SmallImage = Properties.Resources.zoom_out_16;
        //    _rbZoomOut.ToggleGroupKey = kHydroMapTools;
        //    head.Add(_rbZoomOut);

        //    //ZoomToFullExtent
        //    var _rbMaxExtents = new SimpleActionItem(kHomeRoot, "MaxExtents", rbFullExtent_Click);
        //    _rbMaxExtents.ToolTipText = "Maximum Extents";
        //    _rbMaxExtents.GroupCaption = rpMapTools;
        //    _rbMaxExtents.LargeImage = Properties.Resources.full_extent;
        //    _rbMaxExtents.SmallImage = Properties.Resources.full_extent_16;
        //    head.Add(_rbMaxExtents);


        //}

        //void rbPan_Click(object sender, EventArgs e) { }
        //void rbZoomIn_Click(object sender, EventArgs e) { }
        //void rbZoomOut_Click(object sender, EventArgs e) { }
        //void rbFullExtent_Click(object sender, EventArgs e) { }
        //void rbDownload_Click(object sender, EventArgs e) { }

        #region Search

        private DateTime?ValidateDateEdit(TextEntryActionItem item, string itemName, string dateFormat, bool showMessage)
        {
            var validateDate = (Func <string, DateTime?>) delegate(string str)
            {
                try
                {
                    return(DateTime.ParseExact(str, dateFormat, CultureInfo.CurrentCulture));
                }
                catch (Exception)
                {
                    return(null);
                }
            };
            var result = validateDate(item.Text);

            if (result == null && showMessage)
            {
                MessageBox.Show(string.Format("{0} is in incorrect format. Please enter {1} in the format {2}", itemName, itemName.ToLower(), dateFormat),
                                string.Format("{0} validation", itemName), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(result);
        }
Beispiel #6
0
        private DateTime?ValidateDateEdit(TextEntryActionItem item, string itemName, string dateFormat, bool showMessage)
        {
            DateTime?result = null;
            string   error  = null;

            try
            {
                var date = DateTime.ParseExact(item.Text, dateFormat, CultureInfo.CurrentCulture);

                var minDate = new DateTime(1753, 1, 1);
                var maxDate = DateTime.MaxValue;
                if (date < minDate || date > maxDate)
                {
                    throw new Exception(string.Format("Date must be between {0} and {1}", minDate.ToShortDateString(), maxDate.ToShortDateString()));
                }

                result = date;
            }
            catch (ArgumentNullException)
            {
                error = string.Format("{0} should be non-empty. Please enter {1} in the format {2}", itemName,
                                      itemName.ToLower(), dateFormat);
            }
            catch (FormatException)
            {
                error = string.Format("Invalid {0}. Please enter a valid calendar date.", itemName);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            if (!string.IsNullOrEmpty(error) && showMessage)
            {
                MessageBox.Show(error, string.Format("{0} validation", itemName), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(result);
        }
Beispiel #7
0
        void rtb_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            TextEntryActionItem te = (TextEntryActionItem)rps_dict["dirbox"];

            ribbonTextBox_textChanged(te);
        }
Beispiel #8
0
        private Dictionary <string, object> BuildRibbonPanel()
        {
            //Create a new Ribbon Panel
            List <SimpleActionItem>     btns = new List <SimpleActionItem>();
            Dictionary <string, object> rps  = new Dictionary <string, object>();

            #region menu panel
            //Open Composition
            var rb = new SimpleActionItem("Open", OpenComp_Click);
            rb.ToolTipText  = "Open a saved model configuration";
            rb.LargeImage   = HydroModeler.Properties.Resources.open.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.open.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Model";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("open", rb);

            //save
            rb              = new SimpleActionItem("Save", Save_Click);
            rb.ToolTipText  = "Save model configuration";
            rb.LargeImage   = HydroModeler.Properties.Resources.save.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.save.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Model";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("save", rb);

            //save as
            rb              = new SimpleActionItem("Save As...", SaveAs_Click);
            rb.ToolTipText  = "Save model configuration as...";
            rb.LargeImage   = HydroModeler.Properties.Resources.saveas.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.saveas.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Model";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("saveas", rb);

            #endregion

            #region model_panel
            //Add Model
            rb              = new SimpleActionItem("Add Component", AddModel_Click);
            rb.ToolTipText  = "Click to add a model to the composition";
            rb.LargeImage   = HydroModeler.Properties.Resources.add_model.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.add_model.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Composition";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("component", rb);

            //Add Trigger
            rb              = new SimpleActionItem("Add Trigger", AddTrigger_Click);
            rb.ToolTipText  = "Click to add a trigger to the composition";
            rb.LargeImage   = HydroModeler.Properties.Resources.trigger.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.trigger.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Composition";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("trigger", rb);

            //Add Connection
            rb              = new SimpleActionItem("Add Connection", AddConnection_Click);
            rb.ToolTipText  = "Click to add a connection to the composition";
            rb.LargeImage   = HydroModeler.Properties.Resources.add_connection.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.add_connection.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Composition";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("connection", rb);

            //Run
            rb              = new SimpleActionItem("Run", Run_Click);
            rb.ToolTipText  = "Run model simulation";
            rb.LargeImage   = HydroModeler.Properties.Resources.run.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.run.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Composition";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("run", rb);

            //Clear Composition
            rb              = new SimpleActionItem("Clear Composition", this.clear_Click);
            rb.ToolTipText  = "Clear all items from the model canvas";
            rb.LargeImage   = HydroModeler.Properties.Resources.delete_icon.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage   = HydroModeler.Properties.Resources.delete_icon.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Composition";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("clear", rb);

            #endregion

            #region dir_panel
            var rtb = new TextEntryActionItem();
            rtb.ToolTipText      = "The current working directory";
            rtb.Width            = 300;
            rtb.GroupCaption     = "Directory";
            rtb.RootKey          = KHydroModeler;
            rtb.Caption          = "Current Path: ";
            rtb.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(rtb_PropertyChanged);
            App.HeaderControl.Add(rtb);
            rps.Add("dirbox", rtb);
            #endregion

            #region view_panel
            rb                = new SimpleActionItem("Pan", this.set_pan);
            rb.ToolTipText    = "Click to activate pan cursor on the model canvas";
            rb.LargeImage     = HydroModeler.Properties.Resources.pan1.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage     = HydroModeler.Properties.Resources.pan1.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption   = "View";
            rb.ToggleGroupKey = "View";
            rb.RootKey        = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("pan", rb);

            rb                = new SimpleActionItem("Select", this.set_select);
            rb.ToolTipText    = "Click to activate the select cursor on the model canvas";
            rb.LargeImage     = HydroModeler.Properties.Resources.select.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            rb.SmallImage     = HydroModeler.Properties.Resources.select.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption   = "View";
            rb.ToggleGroupKey = "View";
            rb.RootKey        = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("select", rb);

            #endregion

            #region help_panel
            rb              = new SimpleActionItem("", this.getHelp);
            rb.ToolTipText  = "Click to launch the HydroModeler help documentation";
            rb.SmallImage   = HydroModeler.Properties.Resources.help.GetThumbnailImage(20, 20, null, IntPtr.Zero);
            rb.GroupCaption = "Help";
            rb.RootKey      = KHydroModeler;
            App.HeaderControl.Add(rb);
            btns.Add(rb);
            rps.Add("help", rb);
            #endregion

            return(rps);
        }
Beispiel #9
0
        public override void Activate()
        {
            #region initialize the Table Ribbon TabPage and related controls

            //RefreshTheme
            var refreshThemeButton = new SimpleActionItem("Refresh", rbRefreshTheme_Click)
            {
                RootKey      = kTableView,
                LargeImage   = Properties.Resources.refreshTheme,
                SmallImage   = Properties.Resources.refreshTheme_16x16,
                ToolTipText  = "Refresh Themes",
                GroupCaption = _tablePanelName,
            };
            App.HeaderControl.Add(refreshThemeButton);

            //DeleteTheme
            var deleteThemeButton = new SimpleActionItem("Remove", rbDeleteTheme_Click)
            {
                RootKey      = kTableView,
                LargeImage   = Properties.Resources.delete,
                SmallImage   = Properties.Resources.delete_16x16,
                ToolTipText  = "Remove Theme from Database",
                GroupCaption = _tablePanelName
            };

            App.HeaderControl.Add(deleteThemeButton);

            //Current database
            dbTextBox = new TextEntryActionItem
            {
                Caption      = "",
                GroupCaption = "Current Database Path",
                RootKey      = kTableView,
                Width        = 300,
                ToolTipText  = "Path to current database"
            };
            dbTextBox.PropertyChanged += dbTextBox_PropertyChanged;
            App.HeaderControl.Add(dbTextBox);

            //Change Database
            var changeDatabaseButton = new SimpleActionItem("Change", rbChangeDatabase_Click)
            {
                RootKey      = kTableView,
                ToolTipText  = "Change Database",
                LargeImage   = Properties.Resources.changeDatabase,
                SmallImage   = Properties.Resources.changeDatabase_16x16,
                GroupCaption = "Current Database Path"
            };
            App.HeaderControl.Add(changeDatabaseButton);

            AddTableViewPanel();

            // Options buttons
            var sequenceModeAction = new SimpleActionItem(_optionsSequenceMode, TableViewModeChanged)
            {
                RootKey        = kTableView,
                ToolTipText    = "Show all fields in sequence",
                LargeImage     = Properties.Resources.series_sequence_32,
                SmallImage     = Properties.Resources.series_sequence_32,
                GroupCaption   = _optionsGroupCaption,
                ToggleGroupKey = _optionsToggleGroupButtonKey
            };
            App.HeaderControl.Add(sequenceModeAction);

            var parallelModeAction = new SimpleActionItem(_optionsParallelMode, TableViewModeChanged)
            {
                RootKey        = kTableView,
                ToolTipText    = "Show just values in parallel",
                LargeImage     = Properties.Resources.series_parallel_32,
                SmallImage     = Properties.Resources.series_parallel_32,
                GroupCaption   = _optionsGroupCaption,
                ToggleGroupKey = _optionsToggleGroupButtonKey
            };
            App.HeaderControl.Add(parallelModeAction);

            parallelModeAction.Toggling += TableViewModeChanged;
            parallelModeAction.Toggle();

            //-----

            #endregion initialize the Table Ribbon TabPage and related controls

            SeriesControl.Refreshed += SeriesControl_Refreshed;

            //event when ribbon tab is changed
            App.HeaderControl.RootItemSelected += HeaderControl_RootItemSelected;

            base.Activate();
        }
Beispiel #10
0
        private void AddSearchRibbon()
        {
            var head = App.HeaderControl;

            //Search ribbon tab
            //setting the sort order to small positive number to display it to the right of home tab
            var root = new RootItem(kHydroSearch3, "Search")
            {
                SortOrder = -10
            };

            try
            {
                App.HeaderControl.Add(root);
            }
            catch (ArgumentException)
            {
                //catch exception in case the root item has been already added
            }

            #region Area group

            const string grpArea = "Area";

            //to get area select mode
            App.Map.FunctionModeChanged += Map_FunctionModeChanged;
            App.Map.SelectionChanged    += Map_SelectionChanged;

            //Draw Box
            rbDrawBox = new SimpleActionItem(kHydroSearch3, "Draw Rectangle", rbDrawBox_Click)
            {
                LargeImage     = Resources.Draw_Box_32,
                SmallImage     = Resources.Draw_Box_16,
                GroupCaption   = grpArea,
                ToggleGroupKey = grpArea
            };
            App.HeaderControl.Add(rbDrawBox);
            SearchSettings.Instance.AreaSettings.AreaRectangleChanged += Instance_AreaRectangleChanged;

            //Select
            rbSelect = new SimpleActionItem(kHydroSearch3, "Select Polygons", rbSelect_Click)
            {
                ToolTipText    = "Select Region",
                LargeImage     = Resources.select_poly_32,
                SmallImage     = Resources.select_poly_16,
                GroupCaption   = grpArea,
                ToggleGroupKey = grpArea
            };
            App.HeaderControl.Add(rbSelect);
            SearchSettings.Instance.AreaSettings.PolygonsChanged += AreaSettings_PolygonsChanged;

            //AttributeTable
            rbAttribute = new SimpleActionItem(kHydroSearch3, "Select by Attribute", rbAttribute_Click)
            {
                ToolTipText    = "Select by Attribute",
                GroupCaption   = grpArea,
                ToggleGroupKey = grpArea,
                LargeImage     = Resources.select_table_32,
                SmallImage     = Resources.select_table_16
            };
            App.HeaderControl.Add(rbAttribute);

            #endregion

            #region Keyword Group

            RefreshKeywordDropDown();

            SearchSettings.Instance.KeywordsSettings.KeywordsChanged += delegate { RefreshKeywordDropDown(); };

            rbKeyword.SelectedValueChanged += rbKeyword_SelectedValueChanged;
            UpdateKeywordsCaption();

            //Keyword more options
            var rbKeyword2 = new SimpleActionItem("Keyword Selection", rbKeyword_Click)
            {
                LargeImage   = Resources.keyword_32,
                SmallImage   = Resources.keyword_16,
                GroupCaption = "Keyword",
                ToolTipText  = "Show Keyword Ontology Tree",
                RootKey      = kHydroSearch3
            };
            head.Add(rbKeyword2);

            #endregion

            #region Dates group

            const string grpDates = "Time Range";
            rbStartDate = new TextEntryActionItem
            {
                Caption = "Start", GroupCaption = grpDates, RootKey = kHydroSearch3, Width = 60
            };
            rbStartDate.PropertyChanged += rbStartDate_PropertyChanged;
            head.Add(rbStartDate);

            rbEndDate = new TextEntryActionItem
            {
                Caption = " End", GroupCaption = grpDates, RootKey = kHydroSearch3, Width = 60
            };
            head.Add(rbEndDate);
            rbEndDate.PropertyChanged += rbEndDate_PropertyChanged;
            UpdateDatesCaption();

            var rbDate = new SimpleActionItem("Select Time", rbDate_Click)
            {
                GroupCaption = grpDates,
                RootKey      = kHydroSearch3,
                LargeImage   = Resources.select_date_v1_32,
                SmallImage   = Resources.select_date_v1_16
            };
            head.Add(rbDate);

            #endregion

            #region Data Sources

            const string grpDataSources = "Data Sources";
            rbServices = new SimpleActionItem("All Data Sources", rbServices_Click);
            ChangeWebServicesIcon();
            rbServices.ToolTipText  = "Select data sources (All web services selected)";
            rbServices.GroupCaption = grpDataSources;
            rbServices.RootKey      = kHydroSearch3;
            head.Add(rbServices);

            rbCatalog = new SimpleActionItem("HIS Central", rbCatalog_Click)
            {
                LargeImage   = Resources.option_32,
                SmallImage   = Resources.option_16,
                ToolTipText  = "Select the Search Catalog",
                GroupCaption = grpDataSources,
                RootKey      = kHydroSearch3
            };
            head.Add(rbCatalog);
            UpdateCatalogCaption();

            #endregion

            #region Search and download buttons

            const string grpSearch = "Search";
            var          rbSearch  = new SimpleActionItem("Run Search", rbSearch_Click)
            {
                LargeImage   = Resources.search_32,
                SmallImage   = Resources.search_16,
                ToolTipText  = "Run Search based on selected criteria",
                GroupCaption = grpSearch,
                RootKey      = kHydroSearch3
            };
            head.Add(rbSearch);

            /*
             * var btnDownload = new SimpleActionItem("Download", rbDownload_Click)
             *                    {
             *                        Enabled = false,
             *                        RootKey = kHydroSearch3,
             *                        GroupCaption = grpSearch,
             *                        LargeImage = Resources.download_32,
             *                        SmallImage = Resources.download_16
             *                    };*/
            //App.HeaderControl.Add(btnDownload);

            #endregion

            App.HeaderControl.RootItemSelected += HeaderControl_RootItemSelected;

            //map buttons (not added for now)
            //AddMapButtons();
        }
Beispiel #11
0
        private void AddSearchRibbon()
        {
            var head = App.HeaderControl;

            //Search ribbon tab
            var root = new RootItem(kHydroFacetedSearch3, "Faceted Search");

            //setting the sort order to small positive number to display it to the right of home tab
            root.SortOrder = -1;
            head.Add(root);

            #region Area group

            const string grpArea = "Area";

            //to get area select mode
            App.Map.FunctionModeChanged += new EventHandler(Map_FunctionModeChanged);
            App.Map.SelectionChanged    += Map_SelectionChanged;

            //Draw Box
            rbDrawBox                = new SimpleActionItem(kHydroFacetedSearch3, "Draw Rectangle", rbDrawBox_Click);
            rbDrawBox.LargeImage     = Resources.Draw_Box_32;
            rbDrawBox.SmallImage     = Resources.Draw_Box_16;
            rbDrawBox.GroupCaption   = grpArea;
            rbDrawBox.ToggleGroupKey = grpArea;
            head.Add(rbDrawBox);
            SearchSettings.Instance.AreaSettings.AreaRectangleChanged += Instance_AreaRectangleChanged;

            //Select
            rbSelect                = new SimpleActionItem(kHydroFacetedSearch3, "Select Polygons", rbSelect_Click);
            rbSelect.ToolTipText    = "Select Region";
            rbSelect.LargeImage     = Resources.select_poly_32;
            rbSelect.SmallImage     = Resources.select_poly_16;
            rbSelect.GroupCaption   = grpArea;
            rbSelect.ToggleGroupKey = grpArea;
            head.Add(rbSelect);
            SearchSettings.Instance.AreaSettings.PolygonsChanged += AreaSettings_PolygonsChanged;

            //AttributeTable
            rbAttribute                = new SimpleActionItem(kHydroFacetedSearch3, "Select by Attribute", rbAttribute_Click);
            rbAttribute.ToolTipText    = "Select by Attribute";
            rbAttribute.GroupCaption   = grpArea;
            rbAttribute.ToggleGroupKey = grpArea;
            rbAttribute.LargeImage     = Resources.select_table_32;
            rbAttribute.SmallImage     = Resources.select_table_16;
            head.Add(rbAttribute);

            #endregion

            #region do not implement these for now - use attribute table selection instead

            ////Select Layer
            //var rbSelectLayer = new DropDownActionItem("kSearch3LayerDropDown", "Layer");
            //rbSelectLayer.GroupCaption = grpArea;
            //rbSelectLayer.AllowEditingText = true;
            //rbSelectLayer.Items.Add("Countries");
            //rbSelectLayer.Items.Add("U.S. States");
            //rbSelectLayer.Items.Add("u.S. HUC");
            //rbSelectLayer.Width = 120;
            //rbSelectLayer.RootKey = kHydroSearch3;
            //head.Add(rbSelectLayer);

            ////Select Field
            //var rbSelectField = new DropDownActionItem("kSearch3FieldDropDown", "Field_");
            //rbSelectField.GroupCaption = grpArea;
            //rbSelectField.AllowEditingText = true;
            //rbSelectField.Items.Add("Name");
            //rbSelectField.Items.Add("Population");
            //rbSelectField.Items.Add("FIPS");
            //rbSelectField.Width = 120;
            ////rbSelectLayer.SelectedItem = "Countries";
            //rbSelectField.RootKey = kHydroSearch3;
            //head.Add(rbSelectField);

            ////Select Value
            //var rbSelectVal = new DropDownActionItem("kSearch3ValueDropDown", "Value ");
            //rbSelectVal.GroupCaption = grpArea;
            //rbSelectVal.AllowEditingText = true;
            //rbSelectVal.Items.Add("Afghanistan");
            //rbSelectVal.Items.Add("Australia");
            //rbSelectVal.Items.Add("Austria");
            //rbSelectVal.Width = 120;
            ////rbSelectLayer.SelectedItem = "Countries";
            //rbSelectVal.RootKey = kHydroSearch3;
            //head.Add(rbSelectVal);

            //rbSelectLayer.SelectedItem = "Countries";
            //rbSelectField.SelectedItem = "Name";

            #endregion

            #region Keyword Group

            // Keyword text entry

            /*
             * const string grpKeyword = "Keyword";
             * rbKeyword = new TextEntryActionItem();
             * rbKeyword.PropertyChanged += rbKeyword_PropertyChanged;
             * rbKeyword.GroupCaption = grpKeyword;
             * rbKeyword.RootKey = kHydroFacetedSearch3;
             * rbKeyword.Width = 150;
             * head.Add(rbKeyword);
             * UpdateKeywordsCaption();
             *
             * //Keyword more options
             * var rbKeyword2 = new SimpleActionItem("Keyword Selection", rbKeyword_Click);
             * rbKeyword2.LargeImage = Resources.keyword_32;
             * rbKeyword2.SmallImage = Resources.keyword_16;
             * rbKeyword2.GroupCaption = grpKeyword;
             * rbKeyword2.ToolTipText = "Show Keyword Ontology Tree";
             * rbKeyword2.RootKey = kHydroFacetedSearch3;
             * head.Add(rbKeyword2);
             */
            #endregion

            #region Dates group

            const string grpDates = "Time Range";
            rbStartDate                  = new TextEntryActionItem();
            rbStartDate.Caption          = "Start";
            rbStartDate.GroupCaption     = grpDates;
            rbStartDate.RootKey          = kHydroFacetedSearch3;
            rbStartDate.Width            = 60;
            rbStartDate.PropertyChanged += rbStartDate_PropertyChanged;
            head.Add(rbStartDate);

            rbEndDate              = new TextEntryActionItem();
            rbEndDate.Caption      = " End";
            rbEndDate.GroupCaption = grpDates;
            rbEndDate.RootKey      = kHydroFacetedSearch3;
            rbEndDate.Width        = 60;
            head.Add(rbEndDate);
            rbEndDate.PropertyChanged += rbEndDate_PropertyChanged;
            UpdateDatesCaption();

            var rbDate = new SimpleActionItem("Select Dates", rbDate_Click);
            rbDate.GroupCaption = grpDates;
            rbDate.RootKey      = kHydroFacetedSearch3;
            rbDate.LargeImage   = Resources.select_date_v1_32;
            rbDate.SmallImage   = Resources.select_date_v1_16;
            head.Add(rbDate);

            #endregion

            #region Web Services group

            /*
             * const string grpServices = "Web Services";
             * rbServices = new SimpleActionItem("All Services", rbServices_Click);
             * ChangeWebServicesIcon();
             * rbServices.ToolTipText = "Select web services (All Services selected)";
             * rbServices.GroupCaption = grpServices;
             * rbServices.RootKey = kHydroFacetedSearch3;
             * head.Add(rbServices);
             */
            #endregion

            #region Catalog group

            /*
             * const string grpCatalog = "Catalog";
             * rbCatalog = new SimpleActionItem("HIS Central", rbCatalog_Click);
             * rbCatalog.LargeImage = Resources.catalog_v2_32;
             * rbCatalog.SmallImage = Resources.catalog_v2_32;
             * rbCatalog.GroupCaption = grpCatalog;
             * rbCatalog.RootKey = kHydroFacetedSearch3;
             * head.Add(rbCatalog);
             * UpdateCatalogCaption();
             */
            #endregion

            #region Search and download buttons

            string grpSearch = "Search";
            var    rbSearch  = new SimpleActionItem("Initialize Faceted Search", rbSearch_Click);
            rbSearch.LargeImage   = Resources.search_32;
            rbSearch.SmallImage   = Resources.search_16;
            rbSearch.ToolTipText  = "Choose facets based on selected spatial and temporal criteria";
            rbSearch.GroupCaption = grpSearch;
            rbSearch.RootKey      = kHydroFacetedSearch3;
            head.Add(rbSearch);

            // var cBShowSpatial = new SimpleActionItem("

            /*
             * var btnDownload = new SimpleActionItem("Download", rbDownload_Click);
             * btnDownload.RootKey = kHydroFacetedSearch3;
             * btnDownload.GroupCaption = grpSearch;
             * btnDownload.LargeImage = Resources.download_32;
             * btnDownload.SmallImage = Resources.download_16;
             * App.HeaderControl.Add(btnDownload);
             */
            #endregion

            //map buttons
            AddMapButtons();

            #region Faceted Search Control

            fsc = new FacetedSearchControl(App);
            App.DockManager.Add(new DotSpatial.Controls.Docking.DockablePanel(kHydroFacetedSearch3, "Faceted Search", fsc, DockStyle.Left));

            #endregion
        }
Beispiel #12
0
        public override void Activate()
        {
            if (SeriesControl == null)
            {
                MessageBox.Show("Cannot activate the TableView plugin. SeriesView not found.");
                return;
            }

            //event for adding the dockable panel
            //App.DockManager.PanelAdded += new EventHandler<DockablePanelEventArgs>(DockManager_PanelAdded);

            #region initialize the Table Ribbon TabPage and related controls

            //RefreshTheme
            var refreshThemeButton = new SimpleActionItem("Refresh", rbRefreshTheme_Click)
            {
                RootKey      = kTableView,
                LargeImage   = Properties.Resources.refreshTheme,
                SmallImage   = Properties.Resources.refreshTheme_16x16,
                ToolTipText  = "Refresh Themes",
                GroupCaption = _tablePanelName
            };
            App.HeaderControl.Add(refreshThemeButton);

            //DeleteTheme
            var deleteThemeButton = new SimpleActionItem("Delete", rbDeleteTheme_Click)
            {
                RootKey      = kTableView,
                LargeImage   = Properties.Resources.delete,
                SmallImage   = Properties.Resources.delete_16x16,
                ToolTipText  = "Delete Theme from Database",
                GroupCaption = _tablePanelName
            };

            App.HeaderControl.Add(deleteThemeButton);

            //Current database
            dbTextBox = new TextEntryActionItem
            {
                Caption      = "",
                GroupCaption = "Current Database Path",
                RootKey      = kTableView,
                Width        = 300,
                ToolTipText  = "Path to current database"
            };
            dbTextBox.PropertyChanged += dbTextBox_PropertyChanged;
            App.HeaderControl.Add(dbTextBox);

            //Change Database
            var changeDatabaseButton = new SimpleActionItem("Change", rbChangeDatabase_Click)
            {
                RootKey      = kTableView,
                ToolTipText  = "Change Database",
                LargeImage   = Properties.Resources.changeDatabase,
                SmallImage   = Properties.Resources.changeDatabase_16x16,
                GroupCaption = "Current Database Path"
            };
            App.HeaderControl.Add(changeDatabaseButton);

            ////New Database
            //var newDatabaseButton = new SimpleActionItem("New", rbNewDatabase_Click);
            //newDatabaseButton.RootKey = kTableView;
            //newDatabaseButton.ToolTipText = "Create New Database";
            //newDatabaseButton.LargeImage = Properties.Resources.newDatabase;
            //newDatabaseButton.SmallImage = Properties.Resources.newDatabase_16x16;
            //newDatabaseButton.GroupCaption = "Database";
            //App.HeaderControl.Add(newDatabaseButton);

            // Options buttons
            var sequenceModeAction = new SimpleActionItem(_optionsSequenceMode, TableViewModeChanged)
            {
                RootKey        = kTableView,
                ToolTipText    = "Show all fields in sequence",
                LargeImage     = Properties.Resources.series_sequence_32,
                SmallImage     = Properties.Resources.series_sequence_32,
                GroupCaption   = _optionsGroupCaption,
                ToggleGroupKey = _optionsToggleGroupButtonKey
            };
            App.HeaderControl.Add(sequenceModeAction);

            var parallelModeAction = new SimpleActionItem(_optionsParallelMode, TableViewModeChanged)
            {
                RootKey        = kTableView,
                ToolTipText    = "Show just values in parallel",
                LargeImage     = Properties.Resources.series_parallel_32,
                SmallImage     = Properties.Resources.series_parallel_32,
                GroupCaption   = _optionsGroupCaption,
                ToggleGroupKey = _optionsToggleGroupButtonKey
            };
            App.HeaderControl.Add(parallelModeAction);
            //-----

            #endregion initialize the Table Ribbon TabPage and related controls

            AddTableViewPanel();

            SeriesControl.Refreshed += SeriesControl_Refreshed;

            //event when ribbon tab is changed
            App.HeaderControl.RootItemSelected += HeaderControl_RootItemSelected;

            base.Activate();
        }
Beispiel #13
0
        private void RecreateKeywordGroup()
        {
            HeaderItem dummy = null;

            if (_currentKeywords != null)
            {
                // This need to save buttons group from removing by HeaderControl (it removes groups with zero HeaderItems).
                dummy = new SimpleActionItem(_searchKey, "Dummy", null)
                {
                    GroupCaption = Msg.Keyword
                };
                App.HeaderControl.Add(dummy);
            }

            Action <ActionItem, Action> removeOrCreate = delegate(ActionItem item, Action factory)
            {
                if (item != null)
                {
                    App.HeaderControl.Remove(item.Key);
                    return;
                }
                factory();
            };

            removeOrCreate(_currentKeywords, delegate
            {
                _currentKeywords = new TextEntryActionItem
                {
                    GroupCaption = Msg.Keyword,
                    RootKey      = _searchKey,
                    Width        = 170,
                };
            });

            removeOrCreate(_dropdownKeywords, delegate
            {
                _dropdownKeywords = new DropDownActionItem
                {
                    AllowEditingText = true,
                    GroupCaption     = Msg.Keyword,
                    RootKey          = _searchKey,
                    Width            = 170,
                    NullValuePrompt  = "[Enter Keyword]"
                };



                _dropdownKeywords.SelectedValueChanged +=
                    delegate(object sender, SelectedValueChangedEventArgs args)
                {
                    if (args.SelectedItem == null)
                    {
                        _dropdownKeywords.SelectedItem = "";
                        return;
                    }

                    //    var current = /*_currentKeywords.Text;*/ _dropdownKeywords.SelectedItem.ToString();
                    var selected = args.SelectedItem.ToString();

                    // var hasKeywords = !string.IsNullOrWhiteSpace(current);
                    //  current = !hasKeywords
                    //                  ? selected
                    //                   : selected + KEYWORDS_SEPARATOR + " " + current;
                    //   if (hasKeywords)
                    //     {
                    // Remove "All", if new keyword was added, because All + AnyKeyword = All in searching.
                    //        current = current.Replace(KEYWORDS_SEPARATOR + " " + Keywords.Constants.RootName, string.Empty);
                    //     }

                    _currentKeywords.Text        = selected; //current;
                    _currentKeywords.ToolTipText = _currentKeywords.Text;
                };
            });
            removeOrCreate(_rbAddMoreKeywords, delegate
            {
                _rbAddMoreKeywords = new SimpleActionItem(_searchKey, Msg.Add_More_Keywords, rbKeyword_Click)
                {
                    // LargeImage = Resources.keyword_32,
                    SmallImage   = Resources.keyword_16,
                    GroupCaption = Msg.Keyword,
                    ToolTipText  = Msg.Keyword_Tooltip
                };
            });


            // Populate items by keywords
            _dropdownKeywords.Items.Clear();
            _dropdownKeywords.Items.AddRange(/*new [] {Constants.Default }*/ _searchSettings.KeywordsSettings.Keywords);

            // Add items to HeaderControl
            // App.HeaderControl.Add(_currentKeywords);
            //  _currentKeywords.Visible = false;
            // ToolStripItem t = GetItem(_currentKeywords.Key);
            App.HeaderControl.Add(_dropdownKeywords);
            App.HeaderControl.Add(_rbAddMoreKeywords);

            // Clear current keywords text
            _currentKeywords.Text = String.Empty;

            //   _currentKeywords.PropertyChanged +=

            if (dummy != null)
            {
                App.HeaderControl.Remove(dummy.Key);
                App.HeaderControl.SelectRoot(_searchKey);
            }

            UpdateKeywordsCaption();

            var selectedKeywords = _searchSettings.KeywordsSettings.SelectedKeywords.ToList();

            selectedKeywords.Add("All");
            _dropdownKeywords.SelectedItem = "All";
        }
Beispiel #14
0
        private void AddSearchRibbon()
        {
            var head = App.HeaderControl;

            //Search ribbon tab
            //setting the sort order to small positive number to display it to the right of home tab
            head.Add(tabb);
            #region Area group
            // Added as a temporary measure to prevent disabling and enabling of draw rectangle button when repeatedly clicked.  If clicked once, it shouldn't be disabled after clicking the same button again.
            SimpleActionItem dummy = new SimpleActionItem(_searchKey, "Dummy", rbDrawBox_Click)
            {
                GroupCaption = Msg.Area, ToggleGroupKey = Msg.Area, Visible = false
            };
            head.Add(dummy);
            // Added as a temporary measure to prevent disabling and enabling of pan button when repeatedly clicked.  If clicked once, it shouldn't be disabled after clicking the same button again.
            // SimpleActionItem dummy2 = new SimpleActionItem(_searchKey, "Dummy", rbDrawBox_Click) { GroupCaption = Msg.Controls, ToggleGroupKey = Msg.Controls, Visible = false };
            // head.Add(dummy2);

            head.Add(_currentView = new SimpleActionItem(_searchKey, Msg.Current_View, CurrentView_Click)
            {
                GroupCaption = Msg.Area, ToggleGroupKey = Msg.Area, ToolTipText = Msg.Current_View_Tooltip, LargeImage = Resources.current_view_32, SmallImage = Resources.current_view_16
            });
            _useCurrentView = true;
            _currentView.Toggle();


            head.Add(new SimpleActionItem(HeaderControl.HomeRootItemKey, Msg.Select_By_Attribute, rbAttribute_Click)
            {
                GroupCaption = "Map Tool", LargeImage = Resources.select_table_32
            });

            head.Add(rbSelect = new SimpleActionItem(_searchKey, Msg.Select_Features, rbSelect_Click)
            {
                ToolTipText = Msg.Select_Features_Tooltip, LargeImage = Resources.select_poly_32, GroupCaption = Msg.Area, ToggleGroupKey = Msg.Area,
            });
            _searchSettings.AreaSettings.PolygonsChanged += AreaSettings_PolygonsChanged;

            head.Add(rbDrawBox = new SimpleActionItem(_searchKey, Msg.Draw_Rectangle, rbDrawBox_Click)
            {
                ToolTipText = Msg.Draw_Box_Tooltip, LargeImage = Resources.Draw_Box_32, SmallImage = Resources.Draw_Box_16, GroupCaption = Msg.Area, ToggleGroupKey = Msg.Area
            });
            _searchSettings.AreaSettings.AreaRectangleChanged += Instance_AreaRectangleChanged;

            // head.Add(new SimpleActionItem(_searchKey, Msg.Deselect_All, delegate { IEnvelope env; App.Map.MapFrame.ClearSelection(out env); }) { GroupCaption = Msg.Area, ToolTipText = Msg.Deselect_All_Tooltip, SmallImage = Resources.deselect_16x16 });
            //head.Add(new SimpleActionItem(_searchKey, Msg.Zoom_Selected, ZoomSelected_Click) { GroupCaption = Msg.Area, ToolTipText = Msg.Zoom_Selected_Tooltip, SmallImage = Resources.zoom_selection_16x16 });



            // head.Add(new SimpleActionItem(_searchKey, Msg.Pan, delegate { App.Map.FunctionMode = FunctionMode.Pan; }) { GroupCaption = Msg.Controls, SmallImage = Resources.hand_16x16, ToggleGroupKey = Msg.Controls });
            //  head.Add(new SimpleActionItem(_searchKey, Msg.Zoom_In, delegate { App.Map.FunctionMode = FunctionMode.ZoomIn; }) { GroupCaption = Msg.Controls, ToolTipText = Msg.Zoom_In_Tooltip, SmallImage = Resources.zoom_in_16x16, ToggleGroupKey = Msg.Controls });
            //  head.Add(new SimpleActionItem(_searchKey, Msg.Zoom_Out, delegate { App.Map.FunctionMode = FunctionMode.ZoomOut; }) { GroupCaption = Msg.Controls, ToolTipText = Msg.Zoom_Out_Tooltip, SmallImage = Resources.zoom_out_16x16, ToggleGroupKey = Msg.Controls });

            #endregion

            #region Keyword Group

            RecreateKeywordGroup();
            _searchSettings.KeywordsSettings.KeywordsChanged += delegate { RecreateKeywordGroup(); };

            #endregion

            #region Dates group

            rbStartDate = new TextEntryActionItem {
                Caption = Msg.TimeRange_Start, GroupCaption = Msg.Time_Range, RootKey = _searchKey, Width = 70
            };
            rbStartDate.PropertyChanged += rbStartDate_PropertyChanged;
            head.Add(rbStartDate);

            rbEndDate = new TextEntryActionItem {
                Caption = Msg.TimeRange_End, GroupCaption = Msg.Time_Range, RootKey = _searchKey, Width = 70
            };
            head.Add(rbEndDate);
            rbEndDate.PropertyChanged += rbEndDate_PropertyChanged;
            UpdateDatesCaption();

            head.Add(new SimpleActionItem(_searchKey, Msg.Select_Dates, rbDate_Click)
            {
                GroupCaption = Msg.Time_Range, LargeImage = Resources.select_date_v1_32, SmallImage = Resources.select_date_v1_16
            });

            #endregion

            #region Data Sources

            var grpDataSources = SharedConstants.SearchDataSourcesGroupName;
            rbServices = new SimpleActionItem(Msg.Select_Data_Sources, rbServices_Click);
            ChangeWebServicesIcon();
            rbServices.ToolTipText  = Msg.Select_Data_Sources_Tooltip;
            rbServices.GroupCaption = grpDataSources;
            rbServices.RootKey      = _searchKey;
            head.Add(rbServices);
            head.Add(new SimpleActionItem(_searchKey, Msg.Add_Sites, addDataSites_Click)
            {
                GroupCaption = grpDataSources, LargeImage = Resources.data_sites, ToolTipText = Msg.Add_Sites,
            });
            #endregion

            head.Add(new SimpleActionItem(_searchKey, Msg.Search, rbSearch_Click)
            {
                GroupCaption = Msg.Search, LargeImage = Resources.search_32, SmallImage = Resources.search_16, ToolTipText = Msg.Run_Search_Tooltip,
            });
        }