Example #1
0
        private void OnStartup(object sender, StartupEventArgs e)
        {
            SingleInstanceProtector = new SingleInstanceProtector();

            if (!SingleInstanceProtector.IsFirstInstance())
            {
                SingleInstanceProtector.ShowOtherAppInstance();
                Shutdown();
                return;
            }

            DeviceDriverUninstallerRegistry.DeviceDriverState DPState = DeviceDriverUninstallerRegistry.GetDeviceDriverState(VersionStrings.DeviceDriverVersion, out string InstalledDeviceDriverVersionString);

            switch (DPState)
            {
            case DeviceDriverUninstallerRegistry.DeviceDriverState.NoneInstalled:
                // Installer Window
                StartupUri = new Uri("Main Windows\\InstallerWindow.xaml", UriKind.Relative);
                break;

            case DeviceDriverUninstallerRegistry.DeviceDriverState.OlderInstalled:
                // Update Windows
                StartupUri = new Uri("Main Windows\\UpdaterWindow.xaml", UriKind.Relative);
                break;

            case DeviceDriverUninstallerRegistry.DeviceDriverState.CurrentInstalled:
                // Control Center
                StartupUri = new Uri("Main Windows\\ControlCenterWindow.xaml", UriKind.Relative);
                break;

            case DeviceDriverUninstallerRegistry.DeviceDriverState.NewerInstalled:
                // Show Notice & shutdown
                MessageBox.Show(string.Format(HIDWiimote.ControlCenter.Properties.App.NewerInstalledDialog_MainMessage, VersionStrings.DeviceDriverVersion, InstalledDeviceDriverVersionString), "HID Wiimote Control Center", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                Shutdown();
                return;
            }
        }
Example #2
0
        public static bool IsInstalled()
        {
            DeviceDriverUninstallerRegistry.DeviceDriverState DPState = DeviceDriverUninstallerRegistry.GetDeviceDriverState(VersionStrings.DeviceDriverVersion);

            return(DPState != DeviceDriverUninstallerRegistry.DeviceDriverState.NoneInstalled);
        }