示例#1
0
文件: Program.cs 项目: Ales999/plena
        private static void _preLoadWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _applicationContext.MainForm = _frmMain2;

            _applicationContext.MainForm.Show();


            _frmLogin.Close();
            _frmLogin = null;

            Cursor.Current = Cursors.Default;
        }
示例#2
0
文件: Program.cs 项目: Ales999/plena
        private static void OnAppIdle(object sender, EventArgs e)
        {
            if (_applicationContext.MainForm != null)
            {
                return;
            }


            Application.Idle -= OnAppIdle;
            _frmMain2         = _args.Length > 0 ? new frmMain2(_args[0]) : new frmMain2();


            Cursor.Current = Cursors.WaitCursor;

            /*_preLoadWork = new BackgroundWorker();
             * _preLoadWork.DoWork += new DoWorkEventHandler(_preLoadWork_DoWork);
             * _preLoadWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler
             *      (_preLoadWork_RunWorkerCompleted);
             *
             * _preLoadWork.RunWorkerAsync();*/

            //Instanciate a dummy handle to form so you can use async methods:
            IntPtr dummy = _frmMain2.Handle;

            _applicationContext.MainForm = _frmMain2;

            _frmMain2.PreLoad(_frmLogin);

            /*if(!_frmMain2.PreLoad(_frmLogin))
             * {
             *  //Exit if preload fail!
             *  _frmLogin.Close();
             *  _frmLogin = null;
             *
             *  Cursor.Current = Cursors.Default;
             *  StopDSPlena();
             *
             * }*/

            _applicationContext.MainForm.Show();

            _frmLogin.Close();
            _frmLogin = null;

            Cursor.Current = Cursors.Default;
        }
示例#3
0
        public FrmRegister(FrmLogin parent)
        {
            InitializeComponent();
            radPanorama1.PanelImage = Resources.bg_pattern_grey;

            this.ThemeName         = (new VisualStudio2012LightTheme()).ThemeName;
            lblSearchCEP.ForeColor = Color.Blue;

            //Comment just for tests (register as User Master):
            cbMaster.Visible = false;
            cbMaster.Checked = false;

            //ThemeResolutionService.ApplicationThemeName = VisualStudio2012LightTheme.ThemeName;
            CreateOptions();
            TranslateForm();
            frmLogin = parent;

            tbName.Select();
        }
示例#4
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);
            }
        }