Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchWindow"/> class.
 /// </summary>
 public SearchWindow(Common.CouchDB.Database couchdb)
 {
     InitializeComponent();
     _couchdb         = couchdb;
     _searchForm      = null;
     _boundProperties = new Dictionary <string, UIElement>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchWindow"/> class.
 /// </summary>
 public SearchWindow(Common.CouchDB.Database couchdb)
 {
     InitializeComponent();
     _couchdb = couchdb;
     _searchForm = null;
     _boundProperties = new Dictionary<string, UIElement>();
 }
Пример #3
0
        /// <summary>
        /// Creates the test search form and saves it to the local file system.
        /// </summary>
        void CreateTestSearchForm()
        {
            Common.NetworkPackage.SearchForm sf = new Common.NetworkPackage.SearchForm();

            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Text, "Id", "$guid", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Text, "Extension", "$extension", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.TextCollection, "Tags", "$tags", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "Created", "$created", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "Modified", "$modified", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "Last Access", "$lastaccess", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Text, "User Field 1", "prop1", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "User Field 2", "prop2", ""));

            sf.SaveToFile("settings\\searchform.xml", FileSystem, true);
        }
Пример #4
0
        /// <summary>
        /// Downloads the <see cref="Common.NetworkPackage.SearchForm"/> which contains the collection
        /// of properties for be displayed on the UI.
        /// </summary>
        private void DownloadSearchOptions()
        {
            Common.Network.Message msg = null;
            UpdateUI actUpdateUI       = UpdateUI_DownloadComplete;

            try
            {
                msg = new Common.Network.Message(Settings.Instance.ServerIp, Settings.Instance.ServerPort, "_settings", "searchform", Common.Network.OperationType.GET,
                                                 Common.Network.DataStreamMethod.Memory, null, null, null, null, false, false, true, true, Settings.Instance.NetworkBufferSize,
                                                 Settings.Instance.NetworkTimeout);
                msg.Send();
            }
            catch (Exception e)
            {
                MainWindow.ErrorManager.AddError(Common.ErrorMessage.ErrorCode.SearchOptionDownloadFailed,
                                                 "Failed to Download Search Fields",
                                                 "I failed to download the available fields, please try again.",
                                                 "Failed to download the search fields to be displayed in the SearchWindow.",
                                                 true, true, e);
                return;
            }

            _searchForm = new Common.NetworkPackage.SearchForm();

            try
            {
                _searchForm.Deserialize(msg.State.Stream);
            }
            catch (Exception e)
            {
                MainWindow.ErrorManager.AddError(Common.ErrorMessage.ErrorCode.SearchOptionDeserializationFailed,
                                                 "Failed to Read Search Fields",
                                                 "I failed to read the available searchable fields, please try again.",
                                                 "Failed to deserialize the search fields to be displayed in the SearchWindow.",
                                                 true, true, e);
                return;
            }

            Dispatcher.BeginInvoke(actUpdateUI, System.Windows.Threading.DispatcherPriority.Normal);
        }
Пример #5
0
        /// <summary>
        /// Creates the test search form and saves it to the local file system.
        /// </summary>
        void CreateTestSearchForm()
        {
            Common.NetworkPackage.SearchForm sf = new Common.NetworkPackage.SearchForm();

            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Text, "Id", "$guid", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Text, "Extension", "$extension", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.TextCollection, "Tags", "$tags", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "Created", "$created", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "Modified", "$modified", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "Last Access", "$lastaccess", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Text, "User Field 1", "prop1", ""));
            sf.Add(new Common.NetworkPackage.FormProperty(Common.NetworkPackage.FormProperty.SupportedDataType.Date, "User Field 2", "prop2", ""));

            sf.SaveToFile("settings\\searchform.xml", FileSystem, true);
        }
        /// <summary>
        /// Downloads the <see cref="Common.NetworkPackage.SearchForm"/> which contains the collection 
        /// of properties for be displayed on the UI.
        /// </summary>
        private void DownloadSearchOptions()
        {
            Common.Network.Message msg = null;
            UpdateUI actUpdateUI = UpdateUI_DownloadComplete;
            
            try
            {
                msg = new Common.Network.Message(Settings.Instance.ServerIp, Settings.Instance.ServerPort, "_settings", "searchform", Common.Network.OperationType.GET,
                     Common.Network.DataStreamMethod.Memory, null, null, null, null, false, false, true, true, Settings.Instance.NetworkBufferSize,
                     Settings.Instance.NetworkTimeout);
                msg.Send();
            }
            catch (Exception e)
            {
                MainWindow.ErrorManager.AddError(Common.ErrorMessage.ErrorCode.SearchOptionDownloadFailed,
                    "Failed to Download Search Fields",
                    "I failed to download the available fields, please try again.",
                    "Failed to download the search fields to be displayed in the SearchWindow.",
                    true, true, e);
                return;
            }

            _searchForm = new Common.NetworkPackage.SearchForm();

            try
            {
                _searchForm.Deserialize(msg.State.Stream);
            }
            catch (Exception e)
            {
                MainWindow.ErrorManager.AddError(Common.ErrorMessage.ErrorCode.SearchOptionDeserializationFailed,
                    "Failed to Read Search Fields",
                    "I failed to read the available searchable fields, please try again.",
                    "Failed to deserialize the search fields to be displayed in the SearchWindow.",
                    true, true, e);
                return;
            }

            Dispatcher.BeginInvoke(actUpdateUI, System.Windows.Threading.DispatcherPriority.Normal);
        }