Exemple #1
0
        public WorkspaceSettingsWindow(IServiceProvider serviceProvider, PoshConsole shellHost, Workspace workspace)
        {
            _shellHost = shellHost;
            _workspace = workspace;
            workspace.UnappliedChanges = false;

            _perforce = serviceProvider.GetService <PerforceService>();
            _steam    = serviceProvider.GetService <SteamService>();

            InitializeComponent();
            MainGrid.DataContext       = workspace;
            BranchSelector.ItemsSource = _steam.Cache.SourceGames;
        }
Exemple #2
0
        private void TestPerforce_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var repo = PerforceService.Connect(_workspace.PerforceServer, _workspace.PerforceUser, _workspace.PerforceClient);
                var info = repo.GetServerMetaData(null);

                MessageBox.Show("Connected to Perforce successfully.\nServer version: " + info.Version.Major + "\nServer IP: " + info.Address.Uri, "Perforce", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection to the Perforce server failed: " + ex.Message, "Perforce", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();

            IServiceCollection services      = new ServiceCollection();
            ILoggerFactory     loggerFactory = new LoggerFactory();

            //loggerFactory.AddEventLog();
            loggerFactory.AddDebug();

            // Init IPC server
            var ipcServer = new IpcServer();

            ipcServer.Start(App.IpcPort);

            // Register the services to the container
            services.AddSingleton(loggerFactory);
            services.AddSingleton(ipcServer);
            services.AddSingleton(typeof(SteamService));
            services.AddSingleton(typeof(PerforceService));
            _serviceProvider = services.BuildServiceProvider();

            // Prepare services for use by the main window
            _steamService    = _serviceProvider.GetService <SteamService>();
            _perforceService = _serviceProvider.GetService <PerforceService>();
            var ipcServerTmp = _serviceProvider.GetService <IpcServer>();

            // Register event handlers
            ipcServerTmp.ReceivedRequest += IpcServer_ReceivedRequest;
            FileSelector.FileOpened      += FileSelector_FileOpened;

            if (_perforceService.P4Exists)
            {
                P4V.IsEnabled     = true;
                P4Merge.IsEnabled = true;
                P4Admin.IsEnabled = true;
            }

            // Handle command line arguments
            HandleArguments(Environment.GetCommandLineArgs().Skip(1));
        }