}// TryRemoveService.

        //
        //
        //
        // *************************************************************
        // ****                 LoadServicesFromFile()              ****
        // *************************************************************
        /// <summary>
        /// Creates all services according to XML in config file.
        /// </summary>
        /// <param name="configFileName"></param>
        public bool TryLoadServicesFromFile(string configFileName)
        {
            try
            {
                string filePath = string.Format("{0}{1}", this.Info.UserConfigPath, configFileName);
                List <UV.Lib.IO.Xml.IStringifiable> iStringObjects;
                using (UV.Lib.IO.Xml.StringifiableReader reader = new IO.Xml.StringifiableReader(filePath))
                {
                    iStringObjects = reader.ReadToEnd();
                }
                foreach (UV.Lib.IO.Xml.IStringifiable iStrObj in iStringObjects)
                {
                    TryAddService(iStrObj);
                }
            }
            catch (Exception e)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Exception: {0}\r\nContinue?", e.Message);
                System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(msg.ToString(), "AppServices.TryLoadSerivesFromFile", System.Windows.Forms.MessageBoxButtons.OKCancel);
                // TODO: Shutdown ourselves?
                return(result == System.Windows.Forms.DialogResult.OK);
            }
            return(true);
        }// LoadServicesFromFile()
Exemple #2
0
        }// TryRemoveService.

        //
        //
        //
        // *************************************************************
        // ****                 LoadServicesFromFile()              ****
        // *************************************************************
        /// <summary>
        /// Creates all services according to XML in config file.
        /// </summary>
        /// <param name="configFileName"></param>
        public void LoadServicesFromFile(string configFileName)
        {
            try
            {
                string filePath = string.Format("{0}{1}", this.Info.UserConfigPath, configFileName);
                List <Misty.Lib.IO.Xml.IStringifiable> iStringObjects;
                using (Misty.Lib.IO.Xml.StringifiableReader reader = new IO.Xml.StringifiableReader(filePath))
                {
                    iStringObjects = reader.ReadToEnd();
                }
                foreach (Misty.Lib.IO.Xml.IStringifiable iStrObj in iStringObjects)
                {
                    TryAddService(iStrObj);
                }
            }
            catch (Exception e)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Exception: {0}\r\n", e.Message);
                System.Windows.Forms.MessageBox.Show(msg.ToString(), "AppServices.LoadSerivesFromFile");
            }
        }// LoadServicesFromFile()