private void ChangeSizeClick(string inOvenName) { OvenSpecifics ovenSpec = new OvenSpecifics(inOvenName); ovenSpec.ShowDialog(); if (ovenSpec.getSizeChange()) { removeInstance(inOvenName); InitBaseGrid baseGridClass = new InitBaseGrid(inOvenName); int baseHeight = baseGridClass.getHeight(); int baseWidth = baseGridClass.getWidth(); if (baseWidth <= WraperContent.MaxWidth) { WraperContent.MaxWidth = SystemParameters.PrimaryScreenWidth; } if (baseWidth > WraperContent.MaxWidth) { WraperContent.MaxWidth = baseWidth + 50; } InitMainBorder mainBorderClass = new InitMainBorder(inOvenName, baseHeight, baseWidth); InitMainGrid mainGridClass = new InitMainGrid(inOvenName, baseHeight, baseWidth); mainGridClass.ChangeSizeClick += ChangeSizeClick; mainGridClass.DeleteClick += DeleteClick; mainGridClass.HelpClick += DisplayHelp; Border mainBorder = mainBorderClass.getMainBorder(); Grid mainGrid = mainGridClass.getMainGrid(); Grid baseGrid = baseGridClass.getGrid(); Thickness margin = baseGrid.Margin; margin.Top = 25; margin.Left = 0; margin.Right = 0; margin.Bottom = 0; baseGrid.Margin = margin; mainGrid.Children.Add(baseGrid); mainBorder.Child = mainGrid; elements.Add(baseGridClass); WraperContent.Children.Add(mainBorder); } }
private void addInstance(string ovenName) { InitBaseGrid baseGridClass = new InitBaseGrid(ovenName); int baseHeight = baseGridClass.getHeight(); int baseWidth = baseGridClass.getWidth(); if (baseWidth > WraperContent.MaxWidth) { WraperContent.MaxWidth = baseWidth + 50; } InitMainBorder mainBorderClass = new InitMainBorder(ovenName, baseHeight, baseWidth); InitMainGrid mainGridClass = new InitMainGrid(ovenName, baseHeight, baseWidth); mainGridClass.ChangeSizeClick += ChangeSizeClick; mainGridClass.DeleteClick += DeleteClick; mainGridClass.HelpClick += DisplayHelp; Border mainBorder = mainBorderClass.getMainBorder(); Grid mainGrid = mainGridClass.getMainGrid(); Grid baseGrid = baseGridClass.getGrid(); Thickness margin = baseGrid.Margin; margin.Top = 25; margin.Left = 0; margin.Right = 0; margin.Bottom = 0; baseGrid.Margin = margin; elements.Add(baseGridClass); mainGrid.Children.Add(baseGrid); mainBorder.Child = mainGrid; WraperContent.Children.Add(mainBorder); myEventHandler handler = ActionTaken; if (handler != null) { ActionTaken(false); } }