コード例 #1
0
        internal LauncherWindow(Action <LaunchProfile> launchCallback, IConsole console, InfusionProxy proxy)
        {
            this.console        = console;
            this.proxy          = proxy;
            this.launchCallback = launchCallback;
            InitializeComponent();
            launcherViewModel = new LauncherViewModel(pwd => passwordBox.Password = pwd);

            var profileInstaller = new ProfilesInstaller(console, ProfileRepository.ProfilesPath);

            profileInstaller.Install();
            var profiles = ProfileRepository.LoadProfiles();

            if (profiles != null)
            {
                launcherViewModel.Profiles = new ObservableCollection <LaunchProfile>(profiles);
            }

            string selectedProfileId = ProfileRepository.LoadSelectedProfileId();

            if (profiles != null && !string.IsNullOrEmpty(selectedProfileId))
            {
                launcherViewModel.SelectedProfile = launcherViewModel.Profiles.FirstOrDefault(p => p.Id == selectedProfileId) ?? launcherViewModel.Profiles.FirstOrDefault();
            }
            DataContext = launcherViewModel;
        }
コード例 #2
0
        internal LauncherWindow(Action <Profile> launchCallback)
        {
            this.launchCallback = launchCallback;
            InitializeComponent();
            launcherViewModel = new LauncherViewModel(pwd => passwordBox.Password = pwd);

            var profiles = ProfileRepositiory.LoadProfiles();

            if (profiles != null)
            {
                launcherViewModel.Profiles = new ObservableCollection <Profile>(profiles);
            }

            string selectedProfileId = ProfileRepositiory.LoadSelectedProfileId();

            if (profiles != null && !string.IsNullOrEmpty(selectedProfileId))
            {
                launcherViewModel.SelectedProfile = launcherViewModel.Profiles.FirstOrDefault(p => p.Id == selectedProfileId) ?? launcherViewModel.Profiles.FirstOrDefault();
            }
            DataContext = launcherViewModel;
        }