Example #1
0
 public void CurrentActionOnChanged(MainMenuAction action)
 {
     MyStatusBarModel.Item0 = MainMenuDictionary.Actions[action].StatusBarMessage;
     MyStatusBarModel.ProgressBarVisibility = MainMenuDictionary.Actions[action].IsAsync
         ? Visibility.Visible
         : Visibility.Collapsed;
 }
Example #2
0
        public void Execute(MainMenuAction action)
        {
            int range = (int)action / 100;

            switch (range)
            {
            case 1: _menuFileExecutor.Execute(action); break;

            case 2:
                if (_menuFormsExecutor.Execute(action))
                {
                    _menuFileExecutor.Execute(MainMenuAction.SaveDatabase);
                    IsDbChanged = true;
                }
                break;

            case 3: _menuDiagramExecutor.Execute(action); break;

            case 4: _menuToolsExecutor.Execute(action); break;

            case 5: _menuAboutExecutor.Execute(action); break;

            default:
                break;
            }
        }
Example #3
0
        public bool Execute(MainMenuAction action)
        {
            switch (action)
            {
            case MainMenuAction.ShowDailyBalancesDiagram: ShowDailyBalancesDiagram(); break;

            case MainMenuAction.ShowRatesDiagram: ShowRatesDiagram(); break;

            case MainMenuAction.ShowMonthlyResultDiagram: ShowMonthlyResultDiagram(); break;

            case MainMenuAction.ShowMonthlyIncomeDiagram: ShowMonthlyIncomeDiagram(); break;

            case MainMenuAction.ShowMonthlyOutcomeDiagram: ShowMonthlyOutcomeDiagram(); break;

            case MainMenuAction.ShowExpensePartingOxyPlotDiagram: ShowExpensePartingOxyPlotDiagram(); break;

            case MainMenuAction.ShowOxyplotRatesDiagram: ShowOxyplotRatesDiagram(); break;

            case MainMenuAction.ShowAverageSignificancesDiagram: ShowAverageSignificancesDiagram(); break;

            default:
                return(false);
            }
            return(false);
        }
Example #4
0
        private static void handleMainMenuAction(MainMenuAction action, List <RideList> rideList)
        {
            if (rideList == null)
            {
                return;
            }

            // Ensure that the enum is defined
            if (!Enum.IsDefined(typeof(MainMenuAction), action))
            {
                Console.WriteLine("Please select a valid option.");
                return;
            }

            switch (action)
            {
            case MainMenuAction.offerRide:
                offerRide();
                break;

            case MainMenuAction.requestRide:
                requestRide();
                break;

            case MainMenuAction.showRide:
                showRides();
                break;

            default:
                Console.WriteLine("Invalid input");
                break;
            }
        }
Example #5
0
 public void ActionMethod(MainMenuAction action)
 {
     if (action == MainMenuAction.ShowOfficialRatesForm)
     {
         ShowOfficialRatesForm();
     }
     if (action == MainMenuAction.ShowTransactionsForm)
     {
         ShowTransactionsForm();
     }
 }
Example #6
0
        public void Execute(MainMenuAction action)
        {
            switch (action)
            {
            case MainMenuAction.ShowAboutForm: ShowAboutForm(); break;

            case MainMenuAction.QuitApplication: QuitApplication(); break;

            default: break;
            }
        }
Example #7
0
        /// <summary>
        /// Handle user input action
        /// </summary>
        private void HandleInput(MainMenuAction action)
        {
            switch (action)
            {
            case MainMenuAction.MenuUp:
                if (this._selectWorld)
                {
                    this.NextWorldSelectionIndex(-1);
                }
                else
                {
                    this.NextMenuSelectionIndex(-1);
                }
                break;

            case MainMenuAction.MenuDown:
                if (this._selectWorld)
                {
                    this.NextWorldSelectionIndex(1);
                }
                else
                {
                    this.NextMenuSelectionIndex(1);
                }
                break;

            case MainMenuAction.MenuSelect:
                if (this._selectWorld)
                {
                    this.HandleWorldSelection();
                }
                else
                {
                    this.HandleMenuSelection();
                }
                break;

            case MainMenuAction.Exit:
                if (this._selectWorld)
                {
                    this._selectWorld = false;
                }
                else
                {
                    this.Exit();
                }
                break;

            default:
                break;
            }
        }
Example #8
0
        public Location LoadInn()
        {
            Location returnData;


            returnData             = new Location();
            returnData.Name        = "Prancing Pony";
            returnData.Description = "You belly up to the bar!";

            // Location Actions
            List <LocationAction> locationActions = new List <LocationAction>();

            LocationAction locationAction = new RumorAction("Bartender", this.InnKeepersRumors);

            locationActions.Add(locationAction);

            //Adding rumors from guest in the inn
            LocationAction guestLocationAction = new RumorAction("Guest", this.InnGuestRumors);

            locationActions.Add(guestLocationAction);

            locationAction = new RestAction(5);
            locationActions.Add(locationAction);

            locationAction = new BuyTravelRation();
            locationActions.Add(locationAction);

            locationAction = new SaveAction();
            locationActions.Add(locationAction);

            locationAction = new MainMenuAction();
            locationActions.Add(locationAction);

            locationAction = new ExitGame();
            locationActions.Add(locationAction);

            returnData.Actions = locationActions;

            // Adjacent Locations
            Dictionary <string, LocationDefinition> adjacentLocationDefinitions = new Dictionary <string, LocationDefinition>();

            LocationDefinition locationDefinition = GetTownCenterDefinition();

            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            returnData.AdjacentLocationDefinitions = adjacentLocationDefinitions;

            return(returnData);
        }
Example #9
0
        public bool Execute(MainMenuAction action)
        {
            switch (action)
            {
            case MainMenuAction.ShowSettings: ShowSettings(); break;

            case MainMenuAction.TempItem: TempItem(); break;

            case MainMenuAction.ShowToDoForm: ShowToDoForm(); break;

            case MainMenuAction.ShowRegularPaymentsForm: ShowRegularPaymentsForm(); break;

            default:
                return(false);
            }
            return(false);
        }
Example #10
0
        public bool Execute(MainMenuAction action)
        {
            switch (action)
            {
            case MainMenuAction.ShowTransactionsForm: return(ShowTransactionsForm());

            case MainMenuAction.ShowCurrencyRatesForm: return(ShowCurrencyRatesForm());

            case MainMenuAction.ShowOfficialRatesForm: return(ShowOfficialRatesForm());

            case MainMenuAction.ShowArticlesAssociationsForm: return(ShowArticlesAssociationsForm());

            case MainMenuAction.ShowMonthAnalysisForm: return(ShowMonthAnalysisForm());

            case MainMenuAction.ShowDepositsForm: return(ShowDepositsForm());

            case MainMenuAction.ShowBankDepositOffersForm: return(ShowBankDepositOffersForm());
            }
            return(false);
        }
Example #11
0
        public void Execute(MainMenuAction action)
        {
            switch (action)
            {
            case MainMenuAction.SaveDatabase:
                new DbSerializer().EncryptAndSerialize(_db, _mySettings.GetCombinedSetting("DbFileFullPath"));
                break;

            case MainMenuAction.LoadDatabase:
                _db = new DbSerializer().DecryptAndDeserialize(_mySettings.GetCombinedSetting("DbFileFullPath"));
                break;

            case MainMenuAction.ClearDatabase:
                _dbCleaner.ClearAllTables(_db);
                break;

            case MainMenuAction.MakeDatabaseBackup:
                _dbBackuper.MakeDbTxtCopy();
                break;

            case MainMenuAction.ExportDatabaseToTxt:
                _dbToTxtSaver.SaveDbInTxt();
                break;

            case MainMenuAction.ImportDatabaseFromTxt:
                ImportDatabaseFromTxt();
                break;

            case MainMenuAction.RemoveExtraBackups:
                new DbBackupOrganizer().RemoveIdenticalBackups();
                break;

            case MainMenuAction.RemoveAllNonFirstInMonth:
                new DbBackupOrganizer().RemoveAllNonFirstInMonth();
                break;
            }
        }
Example #12
0
        public async void ActionMethod(MainMenuAction action)
        {
            if (_shellModel.CurrentAction == MainMenuAction.QuitApplication)
            {
                return;
            }
            _shellModel.CurrentAction = action;

            if (_shellModel.MainMenuDictionary.Actions[action].IsAsync)
            {
                await Task.Run(() => _mainMenuExecutor.Execute(action));
            }
            else
            {
                _mainMenuExecutor.Execute(action);
            }

            if (_mainMenuExecutor.IsDbChanged)
            {
                _shellModel.IsDbChanged = true;
            }
            Console.WriteLine($"Done {DateTime.Now}");
            _shellModel.CurrentAction = MainMenuAction.DoNothing;
        }
Example #13
0
        public Location LoadTownCenter()
        {
            Location       returnData;
            LocationAction locationAction;


            returnData             = new Location();
            returnData.Name        = "Banken";
            returnData.Description = "The small town of Banken, located in the middle of the Ashen Forest. There are several wooden buildings throughout the town. The town is mainly populated by Forest Rangers, but there are some civilians living there as well.";

            // Location Actions
            List <LocationAction> locationActions = new List <LocationAction>();

            locationAction = new DisplayStatsAction();
            locationActions.Add(locationAction);

            locationAction = new DisplayInventoryAction();
            locationActions.Add(locationAction);

            locationAction = new DisplayPotionBagAction();
            locationActions.Add(locationAction);

            locationAction = new DisplayEquippedAction();
            locationActions.Add(locationAction);

            locationAction = new AffixSwapperAction();
            locationActions.Add(locationAction);

            locationAction = new StoreAction();
            locationActions.Add(locationAction);

            locationAction = new MainMenuAction();
            locationActions.Add(locationAction);

            locationAction = new ExitGame();
            locationActions.Add(locationAction);

            returnData.Actions = locationActions;



            // Adjacent Locations
            Dictionary <string, LocationDefinition> adjacentLocationDefinitions = new Dictionary <string, LocationDefinition>();

            LocationDefinition locationDefinition = GetArenaDefinition();

            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            locationDefinition = GetInnDefinition();
            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            locationDefinition = GetWarCouncilDefinition();
            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            Accomplishment investigateShrine = Banken.GetBankenAccomplishments().Find(x => x.Name.Contains("Investigate Religious Shrine"));

            if (GameState.Hero.Accomplishments.Contains(investigateShrine))
            {
                locationDefinition = BankenAshenForest.GetTownInstance().GetEntranceDefinition();
                adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);
            }

            locationDefinition = BeachTower.GetTownInstance().GetTownCenterDefinition();
            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            returnData.AdjacentLocationDefinitions = adjacentLocationDefinitions;

            return(returnData);
        }
Example #14
0
        public Location LoadTownCenter()
        {
            Location       returnData;
            LocationAction locationAction;


            returnData             = new Location();
            returnData.Name        = "Watertown Town Center";
            returnData.Description = "Welcome to the cozy Watertown Town Center.";

            // Location Actions
            List <LocationAction> locationActions = new List <LocationAction>();

            locationAction = new DisplayStatsAction();
            locationActions.Add(locationAction);

            locationAction = new DisplayInventoryAction();
            locationActions.Add(locationAction);

            locationAction = new DisplayPotionBagAction();
            locationActions.Add(locationAction);

            locationAction = new DisplayEquippedAction();
            locationActions.Add(locationAction);

            locationAction = new AffixSwapperAction();
            locationActions.Add(locationAction);

            locationAction = new StoreAction();
            locationActions.Add(locationAction);

            locationAction = new MainMenuAction();
            locationActions.Add(locationAction);

            locationAction = new ExitGame();
            locationActions.Add(locationAction);

            returnData.Actions = locationActions;



            // Adjacent Locations
            Dictionary <string, LocationDefinition> adjacentLocationDefinitions = new Dictionary <string, LocationDefinition>();

            LocationDefinition locationDefinition = GetArenaDefinition();

            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            locationDefinition = GetInnDefinition();
            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            locationDefinition = GetConstableOfficeDefinition();
            adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);

            Accomplishment sewerKingAccomplishment = Watertown.GetWatertownAccomplishments().Find(x => x.Name.Contains("Sewer King"));

            if (GameState.Hero.Accomplishments.Contains(sewerKingAccomplishment))
            {
                locationDefinition = WatertownSewer.GetTownInstance().GetSewerEntranceDefinition();
                adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);
            }

            Accomplishment banditCaptainAccomplishment = Watertown.GetWatertownAccomplishments().Find(x => x.Name.Contains("Bandit Captain"));

            if (GameState.Hero.Accomplishments.Contains(banditCaptainAccomplishment))
            {
                locationDefinition = WatertownForest.GetTownInstance().GetForestEntranceDefinition();
                adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);
            }

            Accomplishment murderRoomAccomplishment = Watertown.GetWatertownAccomplishments().Find(x => x.Name.Contains("Bandit Murder"));

            if (GameState.Hero.Accomplishments.Contains(murderRoomAccomplishment))
            {
                locationDefinition = WatertownBanditHouse.GetTownInstance().GetEntranceDefinition();
                adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);
            }

            Accomplishment banditKingAccomplishment = Watertown.GetWatertownAccomplishments().Find(x => x.Name.Contains("Bandit God King"));

            if (GameState.Hero.Accomplishments.Contains(banditKingAccomplishment))
            {
                locationDefinition = Ankou.GetTownInstance().GetTownCenterDefinition();
                adjacentLocationDefinitions.Add(locationDefinition.LocationKey, locationDefinition);
            }

            returnData.AdjacentLocationDefinitions = adjacentLocationDefinitions;

            return(returnData);
        }
Example #15
0
 public MainMenuResult(GUIResult guiResult, MainMenuAction action, NewGameOptions newGameOptions)
 {
     this.guiResult = guiResult;
     this.mainMenuAction = action;
     this.newGameOptions = newGameOptions;
 }
Example #16
0
        private void handleMainMenuAction(MainMenuAction action)
        {
            SpecialCase      FractConv    = new SpecialCase();
            TrigCalculations Calculate    = new TrigCalculations();
            Evaluation       Evalulate    = new Evaluation();
            ConvertUnits     ConvertUnits = new ConvertUnits();

            if (!Enum.IsDefined(typeof(MainMenuAction), action))
            {
                throw new Exception("Undefined number, please use 1-17."); // Throws an exception if the Number is not 1-17.
            }
            // Switch for all the different cases that the user inputs.
            switch (action)
            {
            // If the user inputs 1.
            case MainMenuAction.basiccalculations:
                Console.Write("Enter your equation:\n");
                string  equation = Console.ReadLine();
                decimal Answer   = Evaluation.Evaluate(equation);
                Console.Write(Answer);
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 2.
            case MainMenuAction.convertdegreestoradian:
                Calculate.convertToDegrees();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 3.
            case MainMenuAction.convertradianstodegrees:
                Calculate.convertToRadians();
                Console.ReadKey();
                Console.Clear();
                break;

            //If the user inputs 4.
            case MainMenuAction.referenceanglesolution:
                Calculate.refAngleConv();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 5.
            case MainMenuAction.findingsin:
                Calculate.findSin();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 6.
            case MainMenuAction.findingcos:
                Calculate.findCos();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 7.
            case MainMenuAction.findingtan:
                Calculate.findTan();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 8.
            case MainMenuAction.logcalculator:
                Calculate.LogarithmCalculation();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 9.
            case MainMenuAction.pythagoreantheory:
                Calculate.pythaGorTheorem();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 10.
            case MainMenuAction.lbtokg:
                ConvertUnits.PoundsToKilograms();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 11.
            case MainMenuAction.kgtolb:
                ConvertUnits.KilogramsToPounds();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 12.
            case MainMenuAction.inchestocm:
                ConvertUnits.InchesToCentimeters();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 13.
            case MainMenuAction.cmtoinchestocm:
                ConvertUnits.CentimetersToInches();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 14.
            case MainMenuAction.fahrenheittocelsiustofahrenheit:
                ConvertUnits.FahrenheitToCelsius();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 15.
            case MainMenuAction.celsiustofahrenheit:
                ConvertUnits.CelsiusToFahrenheit();
                Console.ReadKey();
                Console.Clear();
                break;

            // If the user inputs 16.
            case MainMenuAction.exit:
                Environment.Exit(0);
                break;

            case MainMenuAction.invalid:
                throw new Exception("Undefined enum, please pick 1-16.");
            }
        }