Пример #1
0
 //CONSTRUCTORES DE LA CLASE
 #region CONSTRUCTORES DE LA CLASE
 #endregion
 //PROPIEDADES
 #region PROPIEDADES
 #endregion
 //DELEGADOS
 #region DELEGADOS
 #endregion
 //METODOS Y FUNCIONES
 #region METODOS Y FUNCIONES
 public static void Show(string label)
 {
     if (isActive)
     {
         return;
     }
     isActive = true;
     //create the thread with its ThreadStart method
     StatusThread = new Thread(() =>
     {
         try
         {
             console = new FrmConsole(label);
             console.ShowDialog();
             //this call is needed so the thread remains open until the dispatcher is closed
             Dispatcher.Run();
         }
         catch (Exception)
         {
         }
     });
     //run the thread in STA mode to make it work correctly
     StatusThread.SetApartmentState(ApartmentState.STA);
     StatusThread.Priority = ThreadPriority.Normal;
     StatusThread.Start();
 }
Пример #2
0
 public static void Close()
 {
     isActive = false;
     if (console != null)
     {
         //need to use the dispatcher to call the Close method, because the window is created in another thread, and this method is called by the main thread
         console.Dispatcher.InvokeShutdown();
         console      = null;
         StatusThread = null;
     }
     console = null;
 }
Пример #3
0
        private void Start(string args, string sPackName)
        {
            Configuration C = new Configuration();

#pragma warning disable IDE0067 // Objekte verwerfen, bevor Bereich verloren geht
            Process minecraft = new Process();
#pragma warning restore IDE0067 // Objekte verwerfen, bevor Bereich verloren geht
                                // check for "minecraft" folder
            if (!Directory.Exists(_sPacksDir + @"\" + sPackName + @"\minecraft"))
            {
                Directory.CreateDirectory(_sPacksDir + @"\" + sPackName + @"\minecraft");
            }

            minecraft.StartInfo.FileName               = C.GetJavaPath();
            minecraft.StartInfo.WorkingDirectory       = _sPacksDir + @"\" + sPackName + @"\minecraft";
            minecraft.StartInfo.Arguments              = args;
            minecraft.StartInfo.RedirectStandardOutput = true;
            minecraft.StartInfo.RedirectStandardError  = true;
            minecraft.StartInfo.UseShellExecute        = false;
            minecraft.StartInfo.CreateNoWindow         = true;
            minecraft.OutputDataReceived              += new DataReceivedEventHandler(Minecraft_OutputDataReceived);
            minecraft.ErrorDataReceived  += new DataReceivedEventHandler(Minecraft_ErrorDataReceived);
            minecraft.Exited             += new EventHandler(Minecraft_Exited);
            minecraft.EnableRaisingEvents = true;

            // load console
            if (C.ShowConsole == 1)
            {
                CloseOldConsole();
                _console = new FrmConsole();
                _console.Show();
                _console.Clear();
                _console.AddLine(String.Format("UglyLauncher-Version: {0}", Application.ProductVersion), Color.Blue);
                _console.AddLine("Using Java-Version: " + C.GetJavaPath() + " (" + C.GetJavaArch() + "bit)", Color.Blue);
                _console.AddLine("Startparameter:" + args, Color.Blue);
            }

            // start minecraft
            minecraft.Start();
            minecraft.BeginOutputReadLine();
            minecraft.BeginErrorReadLine();
            // raise event
            EventHandler <FormWindowStateEventArgs> handler = RestoreWindow;
            FormWindowStateEventArgs args2 = new FormWindowStateEventArgs
            {
                WindowState = FormWindowState.Minimized,
                MCExitCode  = -1
            };
            handler?.Invoke(this, args2);
        }
Пример #4
0
        public MainForm()
        {
            InitializeComponent();

            CurrentForm = this;
            statusStrip1.BackgroundImage = Itop.Client.Resources.ImageListRes.GetBottomPhoto();


            //ProjectTreeList pl = new ProjectTreeList();
            //if (pl.ShowDialog() != DialogResult.OK)
            //{
            //    bl = true;
            //    this.Close();
            //    return;
            //}
            this.Text = MIS.ApplicationCaption;

            this.FormClosing += delegate {
                Login.UserLogoutCommand.Exec(false);
            };

            SetStatusLabel();

            MIS.MainFormInterface = this;


            //创建控制台
            m_mainConsoleForm = new FrmConsole();
            //m_mainConsoleForm = new FrmMain();
            //m_mainConsoleForm.PJ = pl.PJ;
            m_mainConsoleForm.MdiParent   = this;
            m_mainConsoleForm.WindowState = FormWindowState.Maximized;
            m_mainConsoleForm.TopMost     = true;
            m_mainConsoleForm.Show();


            m_mainMenu.Visible = false;
            // 创建主菜单
            ////////RefreshMainMenu();

            this.Shown += delegate {
                // TODO 下面的代码是临时性质的代码
                //Itop.Server.Interface.Forms.IFormsAction fa =
                //    Itop.Common.RemotingHelper.GetRemotingService<Itop.Server.Interface.Forms.IFormsAction>();
                //fa.CreateStoredProc(MIS.UserInfo);
            };
            timer1.Start();
        }
Пример #5
0
 /// <summary>
 /// If the console window is not displayed show it, Create and show if necessary
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void consoleMenuItem_Click(object sender, EventArgs e)
 {
     if (ConsoleWindow != null && consoleMenuItem.Checked == false)
     {
         consoleMenuItem.Checked = true;
         ConsoleWindow.Show(DockingPanel, DockState.DockBottom);
     }
     else if (ConsoleWindow != null && consoleMenuItem.Checked == true)
     {
         consoleMenuItem.Checked = false;
         ConsoleWindow.Close();
     }
     else
     {
         ConsoleWindow           = new FrmConsole();
         consoleMenuItem.Checked = true;
         ConsoleWindow.Show(DockingPanel, DockState.DockBottom);
     }
 }