public NormalRunController( InaraApi api, PersistentState state, EliteJournalParser logs, DataMangler dm) { this.api = api; this.state = state; this.logs = logs; this.dm = dm; MaterialTypeLookup = dm.MaterialTypeLookup; MaterialTypes = new List <string>(dm.MaterialTypes); MaterialTypes.Add("Grand"); MaterialOrder = new List <string>(dm.MaterialOrder); foreach (var type in MaterialTypes) { MaterialOrder.Add(type + " Total"); } form = new MatUpdateForm(MaterialOrder); form.ReloadMats += OnReloadMats; form.PostAndSave += OnPostAndSave; form.CloseWithoutSave += OnCloseWithoutSave; form.Activated += ReloadMatsIfNecessary; }
public AuthenticationController(InaraApi api, PersistentState state) { this.api = api; this.state = state; form = new WelcomeLoginForm(); form.TryAuthentication += OnTryAuthentication; }
public FirstRunController(InaraApi api, PersistentState state) { this.api = api; this.state = state; // Set up main form and event handlers form = new MatInitialVerifyForm(); form.ReloadMats += OnReloadMats; form.FirstLoadMats += OnFirstLoadMats; form.CloseWithoutSaving += OnCloseWithoutSaving; form.CloseAndSave += OnCloseAndSave; form.Activated += OnReloadMats; InitialMats = null; }
static void Main() { // We would like to thank Microsoft for their generous donation of // these next two codes. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Set up Internal Constants DataMangler dm = DataMangler.GetInstance(); // Set up Registry Keys Configuration cfg = new Configuration(); // See if we need to upgrade the state file HandleUpgrade(); // Program will run in a loop until user chooses "Exit" // on the chooser, or in the main window ChooseCmdrController choose = new ChooseCmdrController(cfg); while (choose.Run()) { // Picard Persistent State PersistentState state = new PersistentState( Filesystem.GetStatePath(choose.CmdrName)); // This needs to be refactored out entirely since the // name is basically chosen on startup. But for now // this should solve the problem. state.CurrentState.EliteCmdrName = choose.CmdrName; // Inara.cz API InaraApi api = new InaraApi(); // Elite Dangerous Gameplay Logs EliteJournalParser logs = new EliteJournalParser( choose.JournalPath); // Show a login dialog box and handle user authentication with Inara AuthenticationController authCtrl = new AuthenticationController(api, state); authCtrl.Run(); // If unauthenticated, that means they closed the login form // Just exit without error, don't write anything if (!api.isAuthenticated) { continue; } if (!state.HasHistory()) { // If there is no stored history, perform an initial // import and then exit FirstRunController firstRunCtrl = new FirstRunController( api, state); firstRunCtrl.Run(); } else { // If there is stored history, run the main program. NormalRunController normalRunCtrl = new NormalRunController( api, state, logs, dm); normalRunCtrl.Run(); } } /*if(!state.HasEliteCmdrName()) * { * StateFileUpgrader.StateFileUpgrader drat = new StateFileUpgrader.StateFileUpgrader(logs, state); * drat.Run(); * } * * if (state.HasEliteCmdrName()) * { * }*/ }