Ejemplo n.º 1
0
        /// <summary>
        /// vGamePadのスタートアップ処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_Startup(object sender, StartupEventArgs e)
        {
#if DEBUG
#else
            var digitizer = Digitizer.GetDigitizer();
            if (!digitizer.Supported)
            {
                var dialog = new vGamePad.DialogWindow.DialogWindow(
                    vGamePad.Properties.Resources.ExceptionTitle,
                    vGamePad.Properties.Resources.ExceptionMessage002);
                dialog.ShowDialog();
                Shutdown(-1);
            }
#endif
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var ver = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);

            var profilePath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\" + ver.CompanyName + "\\" + ver.ProductName;
            Directory.CreateDirectory(profilePath);
            ProfileOptimization.SetProfileRoot(profilePath);
            ProfileOptimization.StartProfile("vGamePad.JIT.Profile");

            Directory.CreateDirectory(UserDataPath);

            if (!mutex.WaitOne(0, false))
            {
                mutex.Close();
                mutex = null;
                Shutdown(-1);
            }
            else
            {
                if (vGamePad.Properties.Settings.Default.IsUpgraded == false)
                {
                    // Upgradeを実行する
                    vGamePad.Properties.Settings.Default.Upgrade();
                    // 「Upgradeを実行した」という情報を設定する
                    vGamePad.Properties.Settings.Default.IsUpgraded = true;
                    // 現行バージョンの設定を保存する
                    vGamePad.Properties.Settings.Default.Save();
                }
                main = new MainWindow();
                main.Show();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 入力デバイスのデジタイザー機能を照会し、<see cref="Digitizer"> オブジェクトを返します。
        /// </see></summary>
        public static Digitizer GetDigitizer()
        {
            var result = (DigitizerType)NativeMethods.GetSystemMetrics((int)NativeMethods.SystemMetric.SM_DIGITIZER);

            var digitizer = new Digitizer
            {
                Supported = result != DigitizerType.NotSupported,
                Type      = result,
            };

            if (digitizer.Supported)
            {
                var max = NativeMethods.GetSystemMetrics((int)NativeMethods.SystemMetric.SM_MAXIMUMTOUCHES);
                digitizer.MaxTouches = max;
            }

            return(digitizer);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 入力デバイスのデジタイザー機能を照会し、<see cref="Digitizer"> オブジェクトを返します。
        /// </see></summary>
        public static Digitizer GetDigitizer()
        {
            var result = (DigitizerType)NativeMethods.GetSystemMetrics((int)NativeMethods.SystemMetric.SM_DIGITIZER);

            var digitizer = new Digitizer
            {
                Supported = result != DigitizerType.NotSupported,
                Type = result,
            };

            if (digitizer.Supported)
            {
                var max = NativeMethods.GetSystemMetrics((int)NativeMethods.SystemMetric.SM_MAXIMUMTOUCHES);
                digitizer.MaxTouches = max;
            }

            return digitizer;
        }