private void CreateTileSheet(Command command) { try { ImportSheetCommand cmd = (ImportSheetCommand)command; int sheetID = 0; SheetError err = m_tileManager.CreateNewSheet(cmd.m_filename, cmd.m_tileSize, ref sheetID); // Check Error - SIZE_MISMATCH is considered okay for now if ((err == SheetError.SUCCESS || err == SheetError.SIZE_MISMATCH) && sheetID != -1) { m_mainWindow.Dispatcher.InvokeAsync((Action) delegate() { m_mainWindow.AddTileSheet(m_tileManager.GetSheet(sheetID)); }); DisplayMessage("Importing " + cmd.m_filename + " at " + cmd.m_tileSize.ToString() + " pixels per tile."); } m_mainWindow.Dispatcher.InvokeAsync((Action) delegate() { cmd.m_callBack(err); }); } catch (InvalidCastException) { /*Add Logging in Future for Internal Error*/ } }
static public Command CreateLoadTileSheetCmd(string filename, int tileSize, ImportCallBack cBack) { ImportSheetCommand cmd = new ImportSheetCommand(filename, tileSize, cBack); return(cmd); }