예제 #1
0
        public Form()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //MessageBox.Show("debug");

            /*try
             * {*/
            string __strTitle;
            int    __rtnLen;
            int    __hwnd;

            __strTitle = new StringBuilder().Append(' ', 256).ToString();

            __rtnLen = GetConsoleTitle(__strTitle, 256);
            if (__rtnLen > 0)
            {
                __strTitle = __strTitle.Substring(0, __rtnLen);
            }

            __hwnd = FindWindow(null, __strTitle);

            this.Text = (string)(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString());
            this.LabelCompiled.Text = (string)("V " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString() + ", Compiled " + CompileDate.BuildDate.ToString());


            __settings.Load(this);

            if (__version.isInstalled())
            {
                __args = Environment.GetCommandLineArgs();
                // 0 if debug mode
                __idx = 1;
                //__args = new string[] { "-s", "V:\\OTCLYON_OfficeTourismeCongrèsLyon\\LCC_LyonCityCard\\04_Design\\02_Desktop\\+ Elements\\etoiles.psb", "png", "index", "12" };
                //__args = new string[] { "-s", "E:\\AI\\02_liste_v04.psd", "jpg", "index", "12" };

                /*#if DEBUG
                 #else
                 *                              MessageBox.Show("debug");
                 *
                 *
                 #endif*/
                //MessageBox.Show(__args[0].ToString());
                int __num = __args.Length - 1;

                __actionDispatcher = new ActionDispatcher(this);
                int __windowState = __actionDispatcher.command(__args);
                //MessageBox.Show(__windowState.ToString());
                ShowWindow(__hwnd, __windowState);
                if (__windowState == SW_HIDE)
                {
                    this.Visible       = false;
                    this.ShowInTaskbar = false;
                    this.WindowState   = FormWindowState.Minimized;
                    Application.Exit();
                    Process.GetCurrentProcess().Kill();
                }
                else
                {
                    //MessageBox.Show("here");
                    SyncUI();
                }
            }
            else
            {
                //MessageBox.Show("there");
                SyncUI();
            }

            /*}
             * catch (Exception __e)
             * {
             *      FileLogger.Instance.Open(@"C:\pstools.log", true);
             *      FileLogger.Instance.CreateEntry(__e.Message);
             *      FileLogger.Instance.Close();
             * }*/

            //MessageBox.Show("ok");
        }
예제 #2
0
        public Form()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //MessageBox.Show("debug");
            /*try
            {*/
                string __strTitle;
                int __rtnLen;
                int __hwnd;

                __strTitle = new StringBuilder().Append(' ', 256).ToString();

                __rtnLen = GetConsoleTitle(__strTitle, 256);
                if (__rtnLen > 0)
                {
                    __strTitle = __strTitle.Substring(0, __rtnLen);
                }

                __hwnd = FindWindow(null, __strTitle);

                this.Text = (string)(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString());
                this.LabelCompiled.Text = (string)("V " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString() + ", Compiled " + CompileDate.BuildDate.ToString());

                __settings.Load(this);

                if (__version.isInstalled())
                {
                    __args = Environment.GetCommandLineArgs();
                    // 0 if debug mode
                    __idx = 1;
                    //__args = new string[] { "-s", "V:\\OTCLYON_OfficeTourismeCongrèsLyon\\LCC_LyonCityCard\\04_Design\\02_Desktop\\+ Elements\\etoiles.psb", "png", "index", "12" };
                    //__args = new string[] { "-s", "E:\\AI\\02_liste_v04.psd", "jpg", "index", "12" };
                    /*#if DEBUG
                    #else
                                    MessageBox.Show("debug");

                    #endif*/
                    //MessageBox.Show(__args[0].ToString());
                    int __num = __args.Length - 1;

                    __actionDispatcher = new ActionDispatcher(this);
                    int __windowState = __actionDispatcher.command(__args);
                    //MessageBox.Show(__windowState.ToString());
                    ShowWindow(__hwnd, __windowState);
                    if (__windowState == SW_HIDE)
                    {
                        this.Visible = false;
                        this.ShowInTaskbar = false;
                        this.WindowState = FormWindowState.Minimized;
                        Application.Exit();
                        Process.GetCurrentProcess().Kill();
                    }
                    else
                    {
                        //MessageBox.Show("here");
                        SyncUI();
                    }
                }
                else
                {
                    //MessageBox.Show("there");
                    SyncUI();
                }
            /*}
            catch (Exception __e)
            {
                FileLogger.Instance.Open(@"C:\pstools.log", true);
                FileLogger.Instance.CreateEntry(__e.Message);
                FileLogger.Instance.Close();
            }*/

            //MessageBox.Show("ok");
        }