예제 #1
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                VerifyFields();

                EnableFields(false);

                LoadStatus(Program.LanguageDefault.DictionaryLogin["ServerValidate"]);

                //if (cbxLembrar.Checked)
                //    Thread.Sleep(1000);

                if (cbxOffline.Checked)
                {
                    Program.LoginAuthentication = ListLoginAuthentication.Instance(Program.LanguageDefault).LoginOffline(txtLogin.Text.ToLower(),
                                                                                                                         Utility.Cript(txtPassword.Text.ToLower()), cbxLembrar.Checked);
                }
                else
                {
                    Program.LoginAuthentication = ListLoginAuthentication.Instance(Program.LanguageDefault).LoadLogin(txtLogin.Text.ToLower(),
                                                                                                                      Utility.Cript(txtPassword.Text.ToLower()), cbxLembrar.Checked);
                }

                if (Program.LoginAuthentication != null)
                {
                    Program.LoginAuthentication.Offline = cbxOffline.Checked;

                    LoadStatus(Program.LanguageDefault.DictionaryLogin["ValidationSuccessful"]);
                    ManagerWorkspace.Instance().LoadTheme();
                    //Thread.Sleep(1000);
                    Program._applicationContext.MainForm = null;
                    return;
                }

                RadMessageBox.Show(Program.LanguageDefault.DictionaryLogin["invalidLogin"], " ");
                EnableFields(true);
                LoadStatus(Program.LanguageDefault.DictionaryLogin["InsertLogin"]);
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                RadMessageBox.Show(ex.Message, " ");
                EnableFields(true);
                LoadStatus(Program.LanguageDefault.DictionaryLogin["InsertLogin"]);
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: Ales999/plena
        static void Main(string[] args)
        {
            try
            {
                Log.Info("\n************************************** ");
                _args = args;

                if (System.IO.Directory.Exists("C:\\Projeto Plena"))
                {
                    Log.Info("\nRegistering STOCKCHARTX... ");
                    string regCmd = "/C regsvr32 /s \"" + "C:\\Projeto Plena\\Plena Trading Platform Release 2\\StockChartX\\Source\\Release\\StockChartX.ocx\"";
                    //Process.Start("cmd.exe", regCmd);
                    Process          process     = new Process();
                    ProcessStartInfo processinfo = new System.Diagnostics.ProcessStartInfo();
                    processinfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                    processinfo.FileName    = "cmd.exe";
                    processinfo.Arguments   = regCmd;
                    process.StartInfo       = processinfo;
                    process.Start();

                    Log.Info("\nRegistering TRADESCRIPT... ");
                    string regCmd2 = "/C regsvr32 /s \"" + "C:\\Projeto Plena\\Plena Trading Platform Release 2\\TradeScript\\trunk\\ReleaseMinSize\\TradeScript.dll\"";
                    //Process.Start("cmd.exe", regCmd);
                    Process          process2     = new Process();
                    ProcessStartInfo processinfo2 = new System.Diagnostics.ProcessStartInfo();
                    processinfo2.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                    processinfo2.FileName    = "cmd.exe";
                    processinfo2.Arguments   = regCmd2;
                    process2.StartInfo       = processinfo2;
                    process2.Start();
                }
                else if (System.IO.Directory.Exists("D:\\Projetos Visual\\Projeto Plena"))
                {
                    Log.Info("\nRegistering STOCKCHARTX... ");
                    string regCmd = "/C regsvr32 /s \"" + "D:\\Projetos Visual\\Projeto Plena\\Plena Trading Platform Release 2\\StockChartX\\Source\\Release\\StockChartX.ocx\"";
                    //Process.Start("cmd.exe", regCmd);
                    Process          process     = new Process();
                    ProcessStartInfo processinfo = new System.Diagnostics.ProcessStartInfo();
                    processinfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                    processinfo.FileName    = "cmd.exe";
                    processinfo.Arguments   = regCmd;
                    process.StartInfo       = processinfo;
                    process.Start();

                    Log.Info("\nRegistering TRADESCRIPT... ");
                    string regCmd2 = "/C regsvr32 /s \"" + "D:\\Projetos Visual\\Projeto Plena\\Plena Trading Platform Release 2\\TradeScript\\trunk\\ReleaseMinSize\\TradeScript.dll\"";
                    //Process.Start("cmd.exe", regCmd);
                    Process          process2     = new Process();
                    ProcessStartInfo processinfo2 = new System.Diagnostics.ProcessStartInfo();
                    processinfo2.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                    processinfo2.FileName    = "cmd.exe";
                    processinfo2.Arguments   = regCmd2;
                    process2.StartInfo       = processinfo2;
                    process2.Start();
                }
                Log.Info("\nLoading Languages... ");
                LoadLanguage();

                if (Properties.Settings.Default.IsFirstUse)
                {
                    Log.Info("\nPLENA IS RUNNIG FIRST TIME! ");
                    Properties.Settings.Default.Upgrade();

                    Properties.Settings.Default.DateInstallation = DateTime.Now;
                    Properties.Settings.Default.IsFirstUse       = false;
                    Properties.Settings.Default.Save();
                }

                Log.Info("\nStarting App Styles... ");
                Application.EnableVisualStyles();
                Log.Info("\nSetCompatibleTextRenderingDefault... ");
                Application.SetCompatibleTextRenderingDefault(false);

                Log.Info("\nChecking files version... ");
                try
                {
                    VersionChecker.VersionChecker.CheckAndCreateDirectories();
                    VersionChecker.VersionChecker.CheckFileVersions(VERSION);
                }
                catch (Exception ex)
                {
                    Log.Info("\nERROR CHECKING VERSION FILES! ");
                    MessageBox.Show("Erro ao iniciar arquivos na base do usuário, entre em contato com nosso suporte!", "ERRO");
                    return;
                }


                Log.Info("\nCreating FrmLogin... ");
                _frmLogin = new M4v2.Authentication.Login.FrmLogin();

                Log.Info("\nStarting Login... ");
                _applicationContext = new ApplicationContext(_frmLogin);

                Log.Info("\nLoading Theme... ");
                ManagerWorkspace.Instance().LoadTheme();

                Log.Info("\nShow FrmLogin... ");
                _frmLogin.Show();
                Application.Idle += OnAppIdle;


                Log.Info("\nStarting DSPlena... ");
                //Comment this just for tests:
                StartDSPlena();
                Log.Info("\nStarting M4... ");

                Application.Run(_applicationContext);
                StopDSPlena();
            }
            catch (Exception ex)
            {
                Log.Info(ex.Message + "\n" + ex.StackTrace);
            }
        }