EasyFarm.ViewModels.MasterViewModel.SelectProcess C# (CSharp) Method

SelectProcess() private method

Selects a process to user for this application.
private SelectProcess ( ) : void
return void
        private void SelectProcess()
        {
            // Let user select ffxi process
            var selectionView = new ProcessSelectionView();
            selectionView.ShowDialog();

            // Grab the view model with the game sessions.
            var viewModel = selectionView.DataContext as ProcessSelectionViewModel;

            // If the view has a process selection view model binded to it.
            if (viewModel != null)
            {
                // Get the selected process.
                var process = viewModel.SelectedProcess;

                // User never selected a process.
                if (process == null || !viewModel.IsProcessSelected)
                {
                    LogViewModel.Write("Process not found");
                    AppServices.InformUser("No valid process was selected.");
                    return;
                }

                // Log that a process selected.
                LogViewModel.Write("Process found");

                // Get memory reader set in config file.
                var fface = MemoryWrapper.Create(process.Id);

                // Set the fface Session.
                SetSession(fface);

                // Tell the user the program has loaded the player's data
                AppServices.InformUser("Bot Loaded: " + fface.Player.Name);

                // Set the main window's title to the player's name.
                MainWindowTitle = "EasyFarm - " + fface.Player.Name;
            }
        }