public ProcessSelectionViewModel(ProcessSelectionView view)
        {
            // When window is closed through X button. 
            _view = view;
            Processes = new ObservableCollection<Process>();

            // Close window on when "Set character" is pressed. 
            SelectCommand = new DelegateCommand(OnSelect);
            RefreshCommand = new DelegateCommand(OnRefresh);

            OnRefresh();
        }
예제 #2
0
        /// <summary>
        ///     Selects a process to user for this application.
        /// </summary>
        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)
                {
                    Logger.Write.ProcessNotFound("Process not found");
                    AppInformer.InformUser("No valid process was selected.");
                    return;
                }

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

                // Save the selected FFACE instance.
                var fface = new FFACE(process.Id);

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

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

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