コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: ultrashot/wpbackup
        public MainWindow()
        {
            InitializeComponent();

            FixFileAssociations();

            try
            {
                var test = new Microsoft.SmartDevice.Connectivity.SmartDeviceException();
            }
            catch (Exception ex)
            {
                MessageBox.Show(LocalizedResources.NoSDK, "WPBackup", MessageBoxButton.OK, MessageBoxImage.Error);
                System.Windows.Forms.Application.Exit();
                return;
            }
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            viewModel.OnModeChanged += new EventHandler(viewModel_OnModeChanged);
            viewModel.OnChange("WorkMode");
            viewModel.OnNavigate += new EventHandler<MainViewModel.NavigateEventArgs>(viewModel_OnNavigate);
            viewModel.Navigate(new pageWelcome(viewModel));
            if (Application.Current.Properties.Contains("CommandLine"))
            {
                foreach (var cl in (Application.Current.Properties["CommandLine"] as string[]))
                {
                    if (System.IO.File.Exists(cl))
                    {
                        var pg = new pageRestoreSelectFile(viewModel);
                        pg.SetFilePath(cl);
                        viewModel.Navigate(pg);
                        break;
                    }
                }
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: dynamics7/wpbackup
        public MainWindow()
        {
            InitializeComponent();

            FixFileAssociations();

            try
            {
                var test = new Microsoft.SmartDevice.Connectivity.SmartDeviceException();
            }
            catch (Exception ex)
            {
                MessageBox.Show(LocalizedResources.NoSDK, "WPBackup", MessageBoxButton.OK, MessageBoxImage.Error);
                System.Windows.Forms.Application.Exit();
                return;
            }
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            viewModel.OnModeChanged += new EventHandler(viewModel_OnModeChanged);
            viewModel.OnChange("WorkMode");
            viewModel.OnNavigate += new EventHandler <MainViewModel.NavigateEventArgs>(viewModel_OnNavigate);
            viewModel.Navigate(new pageWelcome(viewModel));
            if (Application.Current.Properties.Contains("CommandLine"))
            {
                foreach (var cl in (Application.Current.Properties["CommandLine"] as string[]))
                {
                    if (System.IO.File.Exists(cl))
                    {
                        var pg = new pageRestoreSelectFile(viewModel);
                        pg.SetFilePath(cl);
                        viewModel.Navigate(pg);
                        break;
                    }
                }
            }
        }