public static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGui(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }
private static void SetApp() { _app.AddCommand(new ExitCommand(_app)); _app.AddCommand(new ExplainCommand(_app)); _app.AddCommand(new HelpCommand(_app)); _app.AddCommand(new AddCheck(_availabilityProducts, _necessaryProducts, _consumptionProducts)); _app.AddCommand(new AddProduct()); _app.AddCommand(new AddRecipe()); _app.AddCommand(new CommandsAvailabilityProducts(_appAvailabilityProducts, _availabilityProducts, _consumptionProducts, _availableRecipes)); _app.AddCommand(new CommandsNecessaryProducts(_appNecessaryProducts)); _app.AddCommand(new CommandsRecipes(_appRecipes)); }
private static void SetAppAvailabilityProducts() { _appAvailabilityProducts.AddCommand(new ExitCommand(_appAvailabilityProducts)); _appAvailabilityProducts.AddCommand(new ExplainCommand(_appAvailabilityProducts)); _appAvailabilityProducts.AddCommand(new HelpCommand(_appAvailabilityProducts)); _appAvailabilityProducts.AddCommand(new AddAvailabilityProducts(_availabilityProducts, _necessaryProducts, _consumptionProducts, _availableRecipes)); _appAvailabilityProducts.AddCommand(new DisplayAvailabilityProducts(_availabilityProducts)); _appAvailabilityProducts.AddCommand(new ChangeAvailabilityProducts(_availabilityProducts, _consumptionProducts, _availableRecipes)); _appAvailabilityProducts.AddCommand(new RemoveAvailabilityProducts(_availabilityProducts, _necessaryProducts, _consumptionProducts, _availableRecipes)); _appAvailabilityProducts.AddCommand(new ClearAvailabilityProducts(_availabilityProducts, _necessaryProducts, _consumptionProducts, _availableRecipes)); }
private static void SetAppNecessaryProducts() { _appNecessaryProducts.AddCommand(new ExitCommand(_appNecessaryProducts)); _appNecessaryProducts.AddCommand(new ExplainCommand(_appNecessaryProducts)); _appNecessaryProducts.AddCommand(new HelpCommand(_appNecessaryProducts)); _appNecessaryProducts.AddCommand(new AddNecessaryProducts(_availabilityProducts, _necessaryProducts)); _appNecessaryProducts.AddCommand(new DisplayNecessaryProducts(_availabilityProducts, _necessaryProducts, _consumptionProducts)); _appNecessaryProducts.AddCommand(new ChangeNecessaryProducts(_necessaryProducts)); _appNecessaryProducts.AddCommand(new RemoveNecessaryProducts(_availabilityProducts, _necessaryProducts)); _appNecessaryProducts.AddCommand(new ClearNecessaryProducts(_availabilityProducts, _necessaryProducts)); }
public void Execute(params string[] parameters) { if (parameters.Length != 1) { Console.WriteLine("Количество параметров должно быть равно одному"); return; } try { List <Recipe> recipes = GetRecipesFromCategory(parameters[0]); var appRecipes = new Application(); appRecipes.AddCommand(new ExitCommand(appRecipes)); appRecipes.AddCommand(new ExplainCommand(appRecipes)); appRecipes.AddCommand(new HelpCommand(appRecipes)); appRecipes.AddCommand(new AddPossibleRecipes(recipes, _listCategoriesRecipes)); appRecipes.AddCommand(new InfoPossibleRecipes(recipes, _availabilityProducts, _necessaryProducts)); appRecipes.AddCommand(new DisplayPossibleRecipes(recipes)); appRecipes.FindCommand("display").Execute(); appRecipes.Run(Console.In); } catch (ArgumentException e) { Console.WriteLine(e.Message); } }
static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new HelpCommand(app)); app.AddCommand(new DrawPointCommand(picture)); app.AddCommand(new DrawLineCommand(picture)); app.AddCommand(new DrawEllipseCommand(picture)); app.AddCommand(new DrawCircleCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new ListCommand(picture)); app.AddCommand(new ChangeColorCommand(picture)); app.AddCommand(new ChangeWidthCommand(picture)); picture.Changed += ui.Refresh; ui.Start(); app.Run(args); ui.Stop(); }
static void Main(string[] args) { Application app = new Application(); app.AddCommand(new AdditionCommand()); app.AddCommand(new DivideCommand()); app.AddCommand(new MultiplicatinCommand()); app.AddCommand(new SubtractionCommand()); app.AddCommand(new RationalFormatInfoCommand()); app.AddCommand(new HelpCommand(app)); app.AddCommand(new ExitCommand(app)); app.Run(args); Rational r = new Rational(1, 5); int n = 10; n = (int)r; r = n; }
public static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); // Shapes app.AddCommand(new PointCommand(picture)); // Other app.AddCommand(new ListCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new GroupCommand(picture)); app.AddCommand(new UngroupCommand(picture)); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }
public void Execute(params string[] parameters) { if (parameters.Length != 0) { Console.WriteLine("Команда не принимает параметры"); return; } if (_listCategoriesRecipes.Categories.Count == 0) { Console.WriteLine("Список рецептов пуст"); } else { Console.WriteLine("Список для рецептов:"); _listCategoriesRecipes.Print(); } if (_availableRecipes.RecommendedRecipes.Count == 0) { return; } Console.WriteLine("Список рецептов, для которых есть часть продуктов"); _availableRecipes.FindRecommendations(_availabilityProducts.GetProductsAll()); var appRecipes = new Application(); appRecipes.AddCommand(new ExitCommand(appRecipes)); appRecipes.AddCommand(new ExplainCommand(appRecipes)); appRecipes.AddCommand(new HelpCommand(appRecipes)); appRecipes.AddCommand(new AddPossibleRecipes(_availableRecipes.RecommendedRecipes, _listCategoriesRecipes)); appRecipes.AddCommand(new InfoPossibleRecipes(_availableRecipes.RecommendedRecipes, _availabilityProducts, _necessaryProducts)); appRecipes.AddCommand(new DisplayPossibleRecipes(_availableRecipes.RecommendedRecipes)); appRecipes.FindCommand("display").Execute(); appRecipes.Run(Console.In); }
private static void Main() { var game = new StupidGame { Field = new Field(8, 8), Rule = new And( new MoveHasAtLeastCells(2), new AllCellsAreOnField(), new FirstCellNotEmpty(), new CorrectPlayer(), new CorrectMove() //new TargetCellIsEven() ) }; var ui = new GameGraphicalGui(game.Field); ui.RegisterImage(Player.Black.Color + "-r", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/black-r.png"); ui.RegisterImage(Player.White.Color + "-r", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/white-r.png"); ui.RegisterImage(Player.Black.Color + "-e", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/black-e.png"); ui.RegisterImage(Player.White.Color + "-e", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/white-e.png"); ui.RegisterImage(Player.Black.Color + "-q", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/black-q.png"); ui.RegisterImage(Player.White.Color + "-q", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/white-q.png"); ui.RegisterImage(Player.Black.Color + "-k", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/black-k.png"); ui.RegisterImage(Player.White.Color + "-k", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/white-k.png"); ui.RegisterImage(Player.Black.Color + "-h", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/black-h.png"); ui.RegisterImage(Player.White.Color + "-h", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/white-h.png"); ui.RegisterImage(Player.Black.Color + "-p", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/black-p.png"); ui.RegisterImage(Player.White.Color + "-p", "C:/Users/komar/OneDrive/Документы/Visual Studio 2015/Projects/ChesslikeGames/ChesslikeGames/Pictures/white-p.png"); game.Field.Add(new Cell { X = 0, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 1, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 2, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 3, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 4, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 5, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 6, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 7, Y = 1 }, new Figure(Player.White, "p")); game.Field.Add(new Cell { X = 0, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 1, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 2, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 3, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 4, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 5, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 6, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 7, Y = 6 }, new Figure(Player.Black, "p")); game.Field.Add(new Cell { X = 0, Y = 7 }, new Figure(Player.Black, "r")); game.Field.Add(new Cell { X = 1, Y = 7 }, new Figure(Player.Black, "h")); game.Field.Add(new Cell { X = 2, Y = 7 }, new Figure(Player.Black, "e")); game.Field.Add(new Cell { X = 3, Y = 7 }, new Figure(Player.Black, "q")); game.Field.Add(new Cell { X = 4, Y = 7 }, new Figure(Player.Black, "k")); game.Field.Add(new Cell { X = 5, Y = 7 }, new Figure(Player.Black, "e")); game.Field.Add(new Cell { X = 6, Y = 7 }, new Figure(Player.Black, "h")); game.Field.Add(new Cell { X = 7, Y = 7 }, new Figure(Player.Black, "r")); game.Field.Add(new Cell { X = 0, Y = 0 }, new Figure(Player.White, "r")); game.Field.Add(new Cell { X = 1, Y = 0 }, new Figure(Player.White, "h")); game.Field.Add(new Cell { X = 2, Y = 0 }, new Figure(Player.White, "e")); game.Field.Add(new Cell { X = 3, Y = 0 }, new Figure(Player.White, "q")); game.Field.Add(new Cell { X = 4, Y = 0 }, new Figure(Player.White, "k")); game.Field.Add(new Cell { X = 5, Y = 0 }, new Figure(Player.White, "e")); game.Field.Add(new Cell { X = 6, Y = 0 }, new Figure(Player.White, "h")); game.Field.Add(new Cell { X = 7, Y = 0 }, new Figure(Player.White, "r")); var app = new Application(); app.DefaultCommand = new MoveCommand(ui, game, app); app.AddCommand(new ExitCommand(app)); app.AddCommand(new HelpCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(app.DefaultCommand); app.Welcome = game.CurrentPlayer.Color; ui.Start(); app.Run(); ui.Stop(); }
private static void SetAppRecipes() { _appRecipes.AddCommand(new ExitCommand(_appRecipes)); _appRecipes.AddCommand(new ExplainCommand(_appRecipes)); _appRecipes.AddCommand(new HelpCommand(_appRecipes)); _appRecipes.AddCommand(new AddRecipes(_listRecipes)); _appRecipes.AddCommand(new ChangeRecipes(_listRecipes)); _appRecipes.AddCommand(new ClearRecipes(_listRecipes)); _appRecipes.AddCommand(new CookRecipes(_listRecipes, _availabilityProducts, _necessaryProducts, _consumptionProducts)); _appRecipes.AddCommand(new DisplayRecipes(_listRecipes, _availableRecipes, _availabilityProducts, _necessaryProducts)); _appRecipes.AddCommand(new DisplayCategory(_listRecipes, _availabilityProducts, _necessaryProducts)); _appRecipes.AddCommand(new InfoRecipes(_listRecipes, _availabilityProducts, _necessaryProducts)); _appRecipes.AddCommand(new RemoveRecipes(_listRecipes)); }
static void Main(string[] args) { var picture = new Picture(); var ui = new DrawableGUI(picture); var app = new Application(); app.AddCommand(new ExitCommand(app)); app.AddCommand(new ExplainCommand(app)); app.AddCommand(new HelpCommand(app)); app.AddCommand(new DrawPointCommand(picture)); app.AddCommand(new DrawLineCommand(picture)); app.AddCommand(new DrawEllipseCommand(picture)); app.AddCommand(new DrawCircleCommand(picture)); app.AddCommand(new ListCommand(picture)); app.AddCommand(new RemoveCommand(picture)); app.AddCommand(new RotateCommand(picture)); app.AddCommand(new ScaleCommand(picture)); app.AddCommand(new TranslateCommand(picture)); app.AddCommand(new GroupCommand(picture)); app.AddCommand(new UngroupCommand(picture)); app.AddCommand(new SelectionListCommand()); app.AddCommand(new SelectCommand(picture)); app.AddCommand(new SelectionAddCommand(picture)); app.AddCommand(new SelectionRemoveCommand(picture)); app.AddCommand(new UndoCommand(picture)); app.AddCommand(new RedoCommand(picture)); app.AddCommand(new SaveCommand(picture)); app.AddCommand(new LoadCommand(app, picture)); app.AddCommand(new ExportCommand(picture, new SvgExporter())); CommandHistoryContainer.Init(picture); picture.Changed += ui.Refresh; ui.Start(); app.Run(Console.In); ui.Stop(); }