Esempio n. 1
0
        public SettingsForm()
        {
            InitializeComponent();
            btnSave.Click += btnSave_Click;
            var tryLoadGlobalSettings = MainSettings.LoadMonitorCommonGlobalSettings();

            if (!tryLoadGlobalSettings.IsComplete)
            {
                MessageBox.Show(tryLoadGlobalSettings.Message);
                return;
            }

            tbServer1C.Text    = MainForm.MonitorCommonGlobalSettings.Server1C;
            tbBase1C.Text      = MainForm.MonitorCommonGlobalSettings.Base1C;
            tbUser1C.Text      = MainForm.MonitorCommonGlobalSettings.User1C;
            tbPassword1C.Text  = MainForm.MonitorCommonGlobalSettings.Password1C;
            tbPlatform.Text    = MainForm.MonitorCommonGlobalSettings.Platform;
            tbServerSQL.Text   = MainSettings.JsonSettings.ServerTask;
            tbBaseSql.Text     = MainSettings.JsonSettings.BaseTask;
            tbUserSQL.Text     = MainSettings.JsonSettings.UserTask;
            tbPasswordSQL.Text = MainSettings.JsonSettings.PasswordTask;
            tbAddressAst.Text  = MainForm.MonitorCommonGlobalSettings.AddressAst;
            tbUserAst.Text     = MainForm.MonitorCommonGlobalSettings.UserAst;
            tbPasswordAst.Text = MainForm.MonitorCommonGlobalSettings.PasswordAst;
            btnSave.Enabled    = IsChangeExists();
        }
Esempio n. 2
0
        private static void StartApplication()
        {
            var tryLoadGlobalSettings = MainSettings.LoadMonitorCommonGlobalSettings();

            if (!tryLoadGlobalSettings.IsComplete)
            {
                MessageBox.Show(tryLoadGlobalSettings.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            _mainForm = new MainForm();
            _mainForm.LoadForm();
            Application.Run();
        }
Esempio n. 3
0
            static JsonConnection()
            {
                MainSettings.LoadMonitorCommonGlobalSettings();
                EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder();

                entityBuilder.Metadata = "res://*/TaskDBModel.csdl|res://*/TaskDBModel.ssdl|res://*/TaskDBModel.msl";
                entityBuilder.Provider = "System.Data.SqlClient";
                string server   = MainSettings.JsonSettings.ServerTask;
                string dataBase = MainSettings.JsonSettings.BaseTask;
                string user     = MainSettings.JsonSettings.UserTask;
                string password = MainSettings.JsonSettings.PasswordTask;

                entityBuilder.ProviderConnectionString = $"data source={server};initial catalog={dataBase};persist security info=True;user id={user};password={password};MultipleActiveResultSets=True;App=EntityFramework";
                EntityConnectionString = entityBuilder.ToString();
            }