public DynamicKeyboard(string inputFile, Action <double> resizeAction) { InitializeComponent(); inputFilename = inputFile; // Read in XML file, exceptions get displayed to user if (string.IsNullOrEmpty(inputFilename)) { Log.Error("No file specified for dynamic keyboard"); SetupErrorLayout("Error loading file", "No file specified. Please choose a startup file in Management Console."); return; } try { keyboard = XmlKeyboard.ReadFromFile(inputFilename); } catch (Exception e) { Log.Error(e.ToString()); SetupErrorLayout("Error loading file", SplitAndWrapExceptionInfo(e.ToString())); return; } if (ValidateKeyboard()) { // Setup all the UI components SetupGrid(); SetupKeys(); SetupBorders(); //TODO: Might be better to follow pattern for height overrides? } }
public DynamicKeyboard(string inputFile, Action <double> resizeAction) { InitializeComponent(); inputFilename = inputFile; // Read in XML file, exceptions get displayed to user try { keyboard = XmlKeyboard.ReadFromFile(inputFilename); } catch (Exception e) { Log.Error(e.ToString()); SetupErrorLayout("Error loading file", SplitAndWrapExceptionInfo(e.ToString())); return; } if (ValidateKeyboard()) { // Setup all the UI components SetupGrid(); SetupKeys(); // Apply size changes after any optikey general sizing policies. this.SizeChanged += (_, args) => { SetupKeyboardLayout(resizeAction); }; } }