Пример #1
0
        private WebServicesDialog(WebServicesSettings settings, CatalogSettings catalogSettings, KeywordsSettings keywordsSettings,
                                  IMetadataFetcherPlugin metadataFetcher, AppManager App, RectangleDrawing _rectangleDrawing)
        {
            _app = App;
            this._rectangleDrawing = _rectangleDrawing;
            InitializeComponent();

            _settings         = settings;
            _catalogSettings  = catalogSettings;
            _keywordsSettings = keywordsSettings;
            _metadataFetcher  = metadataFetcher;


            switch (_catalogSettings.TypeOfCatalog)
            {
            case TypeOfCatalog.HisCentral:
                rbHisCentral.Checked = true;
                local = false;
                break;

            case TypeOfCatalog.LocalMetadataCache:
                rbLocalMetadataCache.Checked = true;
                local = true;
                break;
            }
            webServicesUserControl1.SetSettings(settings, catalogSettings, local);

            rbHisCentral.CheckedChanged         += rbTypeOfCatalog_CheckedChanged;
            rbLocalMetadataCache.CheckedChanged += rbTypeOfCatalog_CheckedChanged;
            UpdateCatalogSettings();
        }
Пример #2
0
        public static DialogResult ShowDialog(KeywordsSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            using (var form = new KeywordsDialog(settings.Copy()))
            {
                if (SearchSettings.AndSearch == false)
                {
                    form.keywordsUserControl1.radioButton1.Checked = true;
                }
                else if (SearchSettings.AndSearch == true)
                {
                    form.keywordsUserControl1.radioButton2.Checked = true;
                }

                if (form.ShowDialog() == DialogResult.OK)
                {
                    settings.SelectedKeywords = form.keywordsUserControl1.GetSelectedKeywords();

                    if (form.keywordsUserControl1.radioButton1.Checked == true)
                    {
                        SearchSettings.AndSearch = false;
                    }
                    else if (form.keywordsUserControl1.radioButton2.Checked == true)
                    {
                        SearchSettings.AndSearch = true;
                    }
                }

                return(form.DialogResult);
            }
        }
Пример #3
0
        /// <summary>
        /// Set data into control.
        /// </summary>
        /// <param name="keywordsSettings">Keyword settings.</param>
        /// <exception cref="ArgumentNullException">Throws if <paramref name="keywordsSettings"/> is null.</exception>
        public void BindKeywordsSettings(KeywordsSettings keywordsSettings)
        {
            if (keywordsSettings == null)
            {
                throw new ArgumentNullException("keywordsSettings");
            }

            _keywordsSettings = keywordsSettings;

            tboTypeKeyword.Clear();
            lblKeywordRelation.Text = "";

            // Keywords
            lbKeywords.DataSource = keywordsSettings.Keywords;

            // Ontology tree
            treeviewOntology.BeginUpdate();
            treeviewOntology.Nodes.Clear();
            FillTreeviewOntology(treeviewOntology.Nodes, keywordsSettings.OntologyTree.Nodes);
            treeviewOntology.EndUpdate();

            // Selected keywords
            AddSelectedKeywords(keywordsSettings.SelectedKeywords);
            if (keywordsSettings.SelectedKeywords.Any())
            {
                UpdateKeywordTextBox(keywordsSettings.SelectedKeywords.First());
            }
        }
Пример #4
0
 private KeywordsDialog(KeywordsSettings settings)
 {
     InitializeComponent();
     Load += delegate
     {
         keywordsUserControl1.BindKeywordsAndOntologyTree(settings.Keywords, settings.OntologyTree);
         keywordsUserControl1.AddSelectedKeywords(settings.SelectedKeywords);
     };
 }
        /// <summary>
        /// Set data into control.
        /// </summary>
        /// <param name="keywordsSettings">Keyword settings.</param>
        /// <exception cref="ArgumentNullException">Throws if <paramref name="keywordsSettings"/> is null.</exception>
        public void BindKeywordsSettings(KeywordsSettings keywordsSettings)
        {
            if (keywordsSettings == null)
            {
                throw new ArgumentNullException("keywordsSettings");
            }

            tboTypeKeyword.Clear();
            tboTypeKeyword.Text             = HydroDesktop.Plugins.Search.Keywords.Constants.EnterKeyword;
            lblKeywordRelation.Text         = "";
            tboTypeKeyword.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            var autoCompleteSource = new AutoCompleteStringCollection();

            autoCompleteSource.AddRange(keywordsSettings.Keywords.ToArray());
            tboTypeKeyword.AutoCompleteCustomSource = autoCompleteSource;
            tboTypeKeyword.AutoCompleteSource       = AutoCompleteSource.CustomSource;

            tboTypeKeyword.Click += delegate(object sender, EventArgs e)
            {
                if (tboTypeKeyword.Text == HydroDesktop.Plugins.Search.Keywords.Constants.EnterKeyword)
                {
                    tboTypeKeyword.Text      = "";
                    tboTypeKeyword.ForeColor = System.Drawing.Color.Black;
                }
            };

            tboTypeKeyword.KeyDown += delegate(object sender, KeyEventArgs args)
            {
                if (args.KeyCode == Keys.Enter)
                {
                    treeviewOntology.SelectedNode = null;

                    // Replace keyword by synonym
                    var keyword = tboTypeKeyword.Text.Trim();
                    keyword = keywordsSettings.FindSynonym(keyword);

                    UpdateKeywordTextBox(keyword);
                    AddKeyword();
                }
            };

            // Ontology tree
            treeviewOntology.AfterSelect += tvOntology_AfterSelect;
            treeviewOntology.BeginUpdate();
            treeviewOntology.Nodes.Clear();
            FillTreeviewOntology(treeviewOntology.Nodes, keywordsSettings.OntologyTree.Nodes);
            treeviewOntology.EndUpdate();

            // Selected keywords
            AddSelectedKeywords(keywordsSettings.SelectedKeywords);
            if (keywordsSettings.SelectedKeywords.Any())
            {
                // Select first keyword in textbox
                UpdateKeywordTextBox(keywordsSettings.SelectedKeywords.First());
            }
        }
Пример #6
0
        public static DialogResult ShowDialog(KeywordsSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            using (var form = new KeywordsDialog(settings.Copy()))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    settings.SelectedKeywords = form.keywordsUserControl1.GetSelectedKeywords();
                }

                return(form.DialogResult);
            }
        }
Пример #7
0
        public static DialogResult ShowDialog(CatalogSettings catalogSettings,
                                              WebServicesSettings webServicesSettings,
                                              KeywordsSettings keywordsSettings)
        {
            if (catalogSettings == null)
            {
                throw new ArgumentNullException("catalogSettings");
            }
            if (webServicesSettings == null)
            {
                throw new ArgumentNullException("webServicesSettings");
            }
            if (keywordsSettings == null)
            {
                throw new ArgumentNullException("keywordsSettings");
            }

            using (var form = new SearchCatalogSettingsDialog(catalogSettings.Copy(),
                                                              webServicesSettings.Copy(),
                                                              keywordsSettings.Copy()))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    if (catalogSettings.TypeOfCatalog != form._catalogSettings.TypeOfCatalog ||
                        catalogSettings.HISCentralUrl != form._catalogSettings.HISCentralUrl)
                    {
                        form.RefreshWebServices();
                        form.RefresKeywords();
                    }


                    catalogSettings.Copy(form._catalogSettings);
                    webServicesSettings.Copy(form._webServicesSettings);
                    keywordsSettings.Copy(form._keywordsSettings);
                }

                return(form.DialogResult);
            }
        }
Пример #8
0
        public static DialogResult ShowDialog(WebServicesSettings settings, CatalogSettings catalogSettings,
                                              KeywordsSettings keywordsSettings, IMetadataFetcherPlugin metadataFetcher, AppManager App, RectangleDrawing _rectangleDrawing)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (catalogSettings == null)
            {
                throw new ArgumentNullException("catalogSettings");
            }
            if (keywordsSettings == null)
            {
                throw new ArgumentNullException("keywordsSettings");
            }



            using (var form = new WebServicesDialog(settings.Copy(), catalogSettings.Copy(), keywordsSettings.Copy(), metadataFetcher, App, _rectangleDrawing))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    if (catalogSettings.TypeOfCatalog != form._catalogSettings.TypeOfCatalog ||
                        catalogSettings.HISCentralUrl != form._catalogSettings.HISCentralUrl)
                    {
                        form.RefreshKeywords();
                    }

                    settings.Copy(form._settings);
                    catalogSettings.Copy(form._catalogSettings);
                    // keywordsSettings.Copy(form._keywordsSettings);
                }

                return(form.DialogResult);
            }
        }
Пример #9
0
        private SearchCatalogSettingsDialog(CatalogSettings catalogSettings,
                                            WebServicesSettings webServicesSettings,
                                            KeywordsSettings keywordsSettings)
        {
            if (catalogSettings == null)
            {
                throw new ArgumentNullException("catalogSettings");
            }
            if (webServicesSettings == null)
            {
                throw new ArgumentNullException("webServicesSettings");
            }
            if (keywordsSettings == null)
            {
                throw new ArgumentNullException("keywordsSettings");
            }

            InitializeComponent();


            _catalogSettings     = catalogSettings;
            _webServicesSettings = webServicesSettings;
            _keywordsSettings    = keywordsSettings;

            rbHisCentral.Tag         = TypeOfCatalog.HisCentral;
            rbLocalMetadataCache.Tag = TypeOfCatalog.LocalMetadataCache;

            rbHisCentral.CheckedChanged         += rbTypeOfCatalog_CheckedChanged;
            rbLocalMetadataCache.CheckedChanged += rbTypeOfCatalog_CheckedChanged;

            switch (_catalogSettings.TypeOfCatalog)
            {
            case TypeOfCatalog.HisCentral:
                rbHisCentral.Checked = true;
                break;

            case TypeOfCatalog.LocalMetadataCache:
                rbLocalMetadataCache.Checked = true;
                break;
            }

            txtCustomUrl.TextChanged         += txtCustomUrl_TextChanged;
            rbHisCentral1.Tag                 = CatalogSettings.HISCENTRAL_URL_1;
            rbHisCentral2.Tag                 = CatalogSettings.HISCENTRAL_URL_2;
            rbHisCentral1.CheckedChanged     += rbHisCentral_CheckedChanged;
            rbHisCentral2.CheckedChanged     += rbHisCentral_CheckedChanged;
            rbHisCentalCustom.CheckedChanged += rbHisCentral_CheckedChanged;
            switch (_catalogSettings.HISCentralUrl)
            {
            case CatalogSettings.HISCENTRAL_URL_1:
                rbHisCentral1.Checked = true;
                break;

            case CatalogSettings.HISCENTRAL_URL_2:
                rbHisCentral2.Checked = true;
                break;

            default:
                rbHisCentalCustom.Checked = true;
                break;
            }
        }
Пример #10
0
        private KeywordsDialog(KeywordsSettings settings)
        {
            InitializeComponent();

            Load += delegate { keywordsUserControl1.BindKeywordsSettings(settings); };
        }
Пример #11
0
        public static DialogResult ShowDialog(KeywordsSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            using (var form = new ShaleDialog())
            {
                var res = new List <string>();

                if (SearchSettings.AndSearch == false)
                {
                    form.radioButton1.Checked = true;
                }
                else if (SearchSettings.AndSearch == true)
                {
                    form.radioButton2.Checked = true;
                }

                foreach (Control c in form.groupBox1.Controls)
                {
                    if (c is CheckBox)
                    {
                        if (settings.SelectedKeywords.Contains(c.Text))
                        {
                            ((CheckBox)c).Checked = true;
                        }
                        else
                        {
                            ((CheckBox)c).Checked = false;
                        }


                        if (c.Text == "Discharge")
                        {
                            if (settings.SelectedKeywords.Contains("Discharge, stream"))
                            {
                                ((CheckBox)c).Checked = true;
                            }
                        }
                        if (c.Text == "Total Dissolved Solids")
                        {
                            if (settings.SelectedKeywords.Contains("Solids, total dissolved"))
                            {
                                ((CheckBox)c).Checked = true;
                            }
                        }
                        if (c.Text == "Total Suspended Solids")
                        {
                            if (settings.SelectedKeywords.Contains("Solids, total suspended"))
                            {
                                ((CheckBox)c).Checked = true;
                            }
                        }
                    }
                }

                if (form.ShowDialog() == DialogResult.OK)
                {
                    foreach (Control c in form.groupBox1.Controls)
                    {
                        if (c is CheckBox)
                        {
                            if (((CheckBox)c).Checked == true)
                            {
                                if (c.Text == "Discharge")
                                {
                                    res.Add("Discharge, stream");
                                }
                                else
                                {
                                    res.Add(c.Text);
                                }
                            }
                        }
                    }

                    settings.SelectedKeywords = res;

                    if (form.radioButton1.Checked == true)
                    {
                        SearchSettings.AndSearch = false;
                    }
                    else if (form.radioButton2.Checked == true)
                    {
                        SearchSettings.AndSearch = true;
                    }
                }

                return(form.DialogResult);
            }
        }