Esempio n. 1
0
        public static void Initialize(BaseSplashForm splashForm, BaseOptions options, BaseOptionsForm optionsForm)
        {
            if (Initialized_)
            {
                throw new System.InvalidOperationException("DBApplication already initialized");
            }

            if (optionsForm != null && OptionsForm_ == null)
            {
                OptionsForm_ = optionsForm;
            }

            if (OptionsForm_ == null)
            {
                throw new System.InvalidOperationException("OptionsForm should be setuped by Initialize or OptionsForm property");
            }

            OptionsControlsManager.RegisterOptionControl(typeof(UILanguageOptionsControl), "General", 0, "UI Language", 0);


            if (options == null && Options_ == null)
            {
                Options_ = new BaseOptions();
            }
            else if (Options_ == null)
            {
                Options_ = options;
            }

            if (Options_ == null)
            {
                throw new System.InvalidOperationException("Options should be setuped by Initialize or Options property");
            }


            if (SplashForm_ == null && splashForm == null && !SkipSplashForm_)
            {
                splashForm = new FreeCL.Forms.BaseSplashForm();
            }

            if (splashForm != null)
            {
                splashForm.Show();
                System.Windows.Forms.Application.DoEvents();
                SplashForm_ = splashForm;
            }

            Options_ = BaseOptions.Load(Options_);

            Initialized_ = true;
            System.Windows.Forms.Application.DoEvents();
        }
Esempio n. 2
0
        public static BaseOptions Load(BaseOptions source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            BaseOptions result = source;

            try
            {
                if (System.IO.File.Exists(source.OptionsFileName_))
                {
                    FileStream FStream = new FileStream(source.OptionsFileName_, FileMode.Open, FileAccess.Read, FileShare.Read);
                    if (FStream.Length > 0)
                    {
                        result = (BaseOptions)XmlSerializableObject.Load(FStream, source.GetType(), source.UseSoapSerialization);
                    }
                }
            }
            catch (System.Exception e)
            {
                ErrorMessageBox.Show(
                    string.Format(LangPack.TranslateString(
                                      "Error on opening config file from {0}" +
                                      ".\r\nPossible reason - error in options file format" +
                                      ".\r\nThe configuration will be reset to default values."
                                      ), source.OptionsFileName_),
                    LangPack.TranslateString("Error on opening config file"),
                    e);
            }
            if (result == source)
            {
                result.OnLoaded();
            }

            return(result);
        }
Esempio n. 3
0
 public BaseForm()
 {
     StartIcon_ = Icon;
     InitializeComponent();
     options = FreeCL.Forms.Application.BaseOptions;
 }
Esempio n. 4
0
        public static BaseOptions Load(BaseOptions source)
        {
            if(source == null)
                throw new ArgumentNullException("source");

            BaseOptions result = source;

            try
            {
                if( System.IO.File.Exists(source.OptionsFileName_))
                {
                    FileStream FStream = new FileStream(source.OptionsFileName_, FileMode.Open, FileAccess.Read, FileShare.Read);
                    if(FStream.Length > 0)
                 		result = (BaseOptions)XmlSerializableObject.Load(FStream, source.GetType(), source.UseSoapSerialization);
             	}
            }
            catch(System.Exception e)
            {
                ErrorMessageBox.Show(
                    string.Format(LangPack.TranslateString(
                        "Error on opening config file from {0}" +
                        ".\r\nPossible reason - error in options file format" +
                        ".\r\nThe configuration will be reset to default values."
                        ),source.OptionsFileName_),
                    LangPack.TranslateString("Error on opening config file"),
                    e);

            }
            if(result == source)
                result.OnLoaded();

            return result;
        }
Esempio n. 5
0
        public static void Initialize(BaseSplashForm splashForm, BaseOptions options, BaseOptionsForm optionsForm)
        {
            if(Initialized_)
                throw new System.InvalidOperationException("DBApplication already initialized");

            if(optionsForm != null && OptionsForm_ == null)
                OptionsForm_ = optionsForm;

            if(OptionsForm_ == null)
                throw new System.InvalidOperationException("OptionsForm should be setuped by Initialize or OptionsForm property");

            OptionsControlsManager.RegisterOptionControl(typeof(UILanguageOptionsControl), "General", 0, "UI Language", 0);

            if(options == null && Options_ == null)
                Options_ = new BaseOptions();
            else if(Options_ == null)
                Options_ = options;

            if(Options_ == null)
                throw new System.InvalidOperationException("Options should be setuped by Initialize or Options property");

            if(SplashForm_ == null && splashForm == null && !SkipSplashForm_)
                splashForm = new FreeCL.Forms.BaseSplashForm();

            if(splashForm != null)
            {
                splashForm.Show();
                System.Windows.Forms.Application.DoEvents();
                SplashForm_ = splashForm;
            }

            Options_ = BaseOptions.Load(Options_);

            Initialized_ = true;
            System.Windows.Forms.Application.DoEvents();
        }