本文整理汇总了C#中CustomMessageBox.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# CustomMessageBox.Dispose方法的具体用法?C# CustomMessageBox.Dispose怎么用?C# CustomMessageBox.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomMessageBox
的用法示例。
在下文中一共展示了CustomMessageBox.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm
public MainForm(AppManager manager)
{
_flgLoading = true;
InitializeComponent();
_manager = manager;
if (_manager == null)
{
CustomMessageBox cmb = new CustomMessageBox("The application manager has not been loaded for some reason.\nThe application can't work and will be closed.", "FATAL", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Fatal, false, false);
cmb.ShowDialog();
cmb.Dispose();
this.Close();
}
InitializeStyle();
InitializeGUIEventsHandlers();
categoriesTabs.Manager = _manager;
SetupUI();
_SelectedCategory = -1;
_SelectedGame = -1;
EnableMenus(false);
if (_manager.AppSettings.ReloadLatestDB && (_manager.RecentDBs != null && _manager.RecentDBs.Count > 0))
OpenRecentDatabase(_manager.RecentDBs.First().Value.DBPath, false);
_flgLoading = false;
}
示例2: RemoveGame
public bool RemoveGame(int GameID)
{
try
{
if (_Connection.State != System.Data.ConnectionState.Open)
//I raise an error as there is no connection to the database
throw new Exception("There is no connection to the database");
String sql = String.Format("DELETE FROM Games WHERE id = {0}", GameID);
SQLiteCommand command = new SQLiteCommand(sql, _Connection);
command.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
CustomMessageBox cmb = new CustomMessageBox("An error raised trying to remove the selected game:\n" + e.Message, "Error",MessageBoxDialogButtons.Ok,MessageBoxDialogIcon.Error,false,false);
cmb.ShowDialog();
cmb.Dispose();
return false;
}
}
示例3: RunGame
private void RunGame(int GameID)
{
if (GameID == -1)
return;
Game gamesFromId = _manager.DB.GetGameFromID(GameID);
string str = _manager.DosBoxHelper.BuildArgs(false, gamesFromId, _manager.AppSettings);
if (str == null)
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 22, "DOSBox cannot be run (was it removed?)!"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 23, "Run Game"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
else
{
if (_manager.AppSettings.ReduceToTrayOnPlay)
{
notifyIcon.Visible = true;
notifyIcon.BalloonTipText = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 73, "DOSBox Manager is still running and will raise back once closing the game.");
notifyIcon.BalloonTipTitle = "DOSBox Manager";
notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon.ShowBalloonTip(500);
Hide();
}
Process process = new Process();
process.StartInfo.WorkingDirectory = gamesFromId.Directory != string.Empty ? gamesFromId.Directory : _manager.FileHelper.ExtractFilePath(gamesFromId.DOSExePath);
process.StartInfo.FileName = _manager.AppSettings.DosboxPath;
process.StartInfo.Arguments = str;
process.Start();
process.WaitForExit();
if (_manager.AppSettings.ReduceToTrayOnPlay)
{
notifyIcon.Visible = false;
Show();
}
}
}
示例4: RecentDatabaseItemClickHandler
private void RecentDatabaseItemClickHandler(object sender, EventArgs e)
{
string text = ((ToolStripItem)sender).Text;
if (_manager.DB != null && _manager.DB.ConnectionStatus == ConnectionState.Open)
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 9, "You are already connected to another database.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 11, "Do you want to close the previous database and open the selected one?"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 8, "Attention"), MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false);
customMessageBox.ShowDialog();
if (customMessageBox.Result == MessageBoxDialogResult.Yes)
OpenRecentDatabase(text, true);
customMessageBox.Dispose();
}
else
OpenRecentDatabase(text, false);
}
示例5: OpenRecentDatabase
private void OpenRecentDatabase(string dbPath, bool closePreviousConnection)
{
if (!File.Exists(dbPath))
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 7, "We are not able to find the selected database inside this computer.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 10, "Do you want to remove it from the list?"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 8, "Attention"), MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false);
customMessageBox.ShowDialog();
if (customMessageBox.Result == MessageBoxDialogResult.Yes)
{
if (_manager.SettingsDB.RemoveRecentDatabase(dbPath))
{
_manager.RecentDBs.Remove(dbPath);
ReloadRecentDBsMenuItems();
}
}
customMessageBox.Dispose();
}
else
{
if (closePreviousConnection)
_manager.DB.Disconnect();
if (!_manager.DB.Connect(dbPath))
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 6, "It has not been possible to open the database!"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 30, "Warning"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Warning, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
else
{
AddDBToRecentAndSetupUI(dbPath, false);
}
}
}
示例6: OpenGameDialog
private void OpenGameDialog(Game game, bool isEditing)
{
GameDialog gameDialog = new GameDialog(_manager, game, isEditing);
if (gameDialog.ShowDialog() != DialogResult.OK)
return;
game = gameDialog.GameData;
if (game == null)
return;
//First I check if there are new categories to be added
Dictionary<String, Category> cats = gameDialog.Cats;
foreach (Category cat in cats.Values)
{
if (cat.ID == -1)
{
int catID = _manager.DB.AddCategory(cat.Name, string.Empty);
if (catID > 0)
{
game.CategoryID = catID;
}
}
}
//I check the game cover path. If it is the temporary path used when loading screenshots from MyAbandonware
// then I copy it inside the game path and I remove the temporary one.
if (game.ImagePath == Application.StartupPath + "\\tmp.img")
{
string newCoverPath = string.Empty;
if (game.Directory != string.Empty)
{
newCoverPath = game.Directory + string.Format("\\{0}.jpg",GetHDFineFileName(game.Title));
}
else if (game.DOSExePath != string.Empty)
{
newCoverPath = _manager.FileHelper.ExtractFilePath(game.DOSExePath) + string.Format("\\{0}.jpg", GetHDFineFileName(game.Title));
}
if (newCoverPath != string.Empty)
{
newCoverPath = GetOverwriteSafeFileName(newCoverPath, 0);
File.Copy(game.ImagePath, newCoverPath, true);
}
game.ImagePath = newCoverPath;
}
//Now I save the game
if (_manager.DB.SaveGame(game))
{
RefreshCategories();
UpdateStatusBar();
LoadCategoryGames(_SelectedCategory);
}
else
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 24, "An issue raised while saving the game."), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
}
示例7: MakeGamesConfiguration
public bool MakeGamesConfiguration(TranslationsHelpers translator, Settings settings, Game game)
{
string body;
string title;
CustomMessageBox cmb;
if (game != null && settings.DosboxDefaultConfFilePath != String.Empty)
{
if(File.Exists(settings.DosboxDefaultConfFilePath)){
body = "'" + game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath) + "' " +
translator.GetTranslatedMessage(settings.Language, 64, "already exists, do you want to overwrite it ?");
title = translator.GetTranslatedMessage(settings.Language, 8, "Attention");
cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false);
if ((!File.Exists(game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath))) || (cmb.ShowDialog() == DialogResult.Yes))
{
if (Directory.Exists(game.Directory))
{
File.Copy(settings.DosboxDefaultConfFilePath, game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath), true);
game.DBConfigPath = game.Directory + "/" + Path.GetFileName(settings.DosboxDefaultConfFilePath);
body = translator.GetTranslatedMessage(settings.Language, 65, "The configuration file has been created correctly.");
title = translator.GetTranslatedMessage(settings.Language, 66, "Success");
cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Information, false, false);
cmb.ShowDialog();
cmb.Dispose();
return true;
}
else
{
body = translator.GetTranslatedMessage(settings.Language, 67, "The path to the selected game seems missing, please check and eventually modify the game folder location to continue.");
title = translator.GetTranslatedMessage(settings.Language, 28, "Error");
cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
cmb.ShowDialog();
cmb.Dispose();
return false;
}
}
else
{
return false;
}
} else {
body = translator.GetTranslatedMessage(settings.Language, 68, "The path to the given DosBox configuration file seems missing, please check and eventually modify the DosBox configuration file location to continue.");
title = translator.GetTranslatedMessage(settings.Language, 28, "Error");
cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
cmb.ShowDialog();
cmb.Dispose();
return false;
}
}
return false;
}
示例8: SearchGames
public List<MyAbandonGameFound> SearchGames(string GameName)
{
try
{
//Preparing URL and result holder
string queryResult = string.Empty;
string queryUri = string.Format(baseSearchUri, GameName);
//Performing web request to retrieve the page.
request = (HttpWebRequest)WebRequest.Create(queryUri);
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = null;
readStream = new StreamReader(receiveStream, Encoding.UTF8);
queryResult = WebUtility.HtmlDecode(readStream.ReadToEnd());
response.Close();
readStream.Close();
}
//Scraping the response to extract the founded games
List<MyAbandonGameFound> result = ParseSearchResult(queryResult);
return result;
}
catch (Exception e)
{
CustomMessageBox cmb = new CustomMessageBox(e.Message, _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
cmb.ShowDialog();
cmb.Dispose();
return null;
}
}
示例9: LoadFoundedGames
private void LoadFoundedGames(SearchEventArgs args)
{
RemoveGamesPanelHandlers();
List<Game> games = _manager.DB.SearchGames(args.Title, args.Year, args.Developer, args.CategoryID);
Dictionary<String, Category> allCategories = _manager.DB.GetAllCategories();
if (catGames != null)
catGames.Dispose();
if (games != null)
{
catGames = new CategoryGames(_manager, games, allCategories);
catGames.BoxChangedSelection += new CategoryGames.BoxChangedSelectionDelegate(CategoryGame_BoxChangedSelection);
catGames.BoxDoubleClick += new CategoryGames.BoxDoubleClickDelegate(CategoryGame_BoxDoubleClick);
catGames.BoxEditClick += new CategoryGames.BoxEditClickDelegate(CategoryGame_BoxEditClick);
catGames.BoxDeleteClick += new CategoryGames.BoxDeleteClickDelegate(CategoryGame_BoxDeleteClick);
catGames.BoxRunClick += new CategoryGames.BoxRunClickDelegate(CategoryGame_BoxRunClick);
catGames.BoxMoveToCategory += new CategoryGames.BoxMoveToCategoryDelegate(CategoryGame_BoxMoveToCategory);
}
else
catGames = (CategoryGames)null;
_SelectedGame = -1;
pnlGames.Controls.Clear();
pnlGames.Controls.Add((Control)catGames);
if (games == null)
{
EnableGamesCommands(true, false);
CustomMessageBox customMessageBox = new CustomMessageBox("No games found which satisfy the specified search parameters.", "Warning", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Warning, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
else
EnableGamesCommands(true, true);
}
示例10: EditGameConfigurationFile
private void EditGameConfigurationFile()
{
if (_SelectedGame == -1)
return;
if (_manager.AppSettings.ConfigEditorPath != string.Empty)
{
if (File.Exists(_manager.AppSettings.ConfigEditorPath))
{
Process.Start(_manager.AppSettings.ConfigEditorPath, _manager.DB.GetGameFromID(_SelectedGame).DBConfigPath + " " + _manager.AppSettings.ConfigEditorAdditionalParameters);
}
else
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 26, "The application can't find the text editor set in the application configuration.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 27, "Please amend the application settings to continue."), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
}
else
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 29, "The text editor has not been set in the configuration file.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 27, "Please amend the application settings to continue."), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 30, "Warning"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Warning, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
}
示例11: EditGame
private void EditGame(int GameID)
{
try
{
Game gamesFromId = _manager.DB.GetGameFromID(GameID);
if (gamesFromId == null)
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 25, "It is not possible to retrieve the information of the selected event!"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
else
OpenGameDialog(gamesFromId, true);
}
catch (Exception ex)
{
CustomMessageBox customMessageBox = new CustomMessageBox(ex.Message, _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
}
示例12: DeleteGame
private void DeleteGame(int GameID)
{
string Body = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 31, "The text editor has not been set in the configuration file.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 21, "Are you sure you want to continue?");
string translatedMessage = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 8, "Attention");
if (_manager.AppSettings.GameDeletePrompt)
{
CustomMessageBox customMessageBox = new CustomMessageBox(Body, translatedMessage, MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, true, true);
customMessageBox.ShowDialog();
if (customMessageBox.Result == MessageBoxDialogResult.Yes)
{
try
{
if (_manager.DB.RemoveGame(GameID))
{
LoadCategoryGames(_SelectedCategory);
UpdateStatusBar();
}
}
catch (Exception ex)
{
throw;
}
}
if (!customMessageBox.AskAgain)
{
_manager.AppSettings.GameDeletePrompt = false;
_manager.SettingsDB.SaveSettings(_manager.AppSettings);
}
customMessageBox.Dispose();
}
else if (_manager.DB.RemoveGame(GameID))
{
LoadCategoryGames(_SelectedCategory);
UpdateStatusBar();
}
}
示例13: DeleteCategory
private void DeleteCategory(int CategoryID)
{
Category category = _manager.DB.GetCategory(CategoryID);
string Body = string.Format(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 19, "You are about to remove the {0} category."), (object)category.Name) + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 20, "This will also remove all the games of the category.") + "\n" + _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 21, "Are you sure you want to continue?");
string translatedMessage = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 8, "Attention");
if (_manager.AppSettings.CategoryDeletePrompt)
{
CustomMessageBox customMessageBox = new CustomMessageBox(Body, translatedMessage, MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Warning, true, true);
customMessageBox.ShowDialog();
if (customMessageBox.Result == MessageBoxDialogResult.Yes && _manager.DB.RemoveCategory(category.ID))
{
RefreshCategories();
UpdateStatusBar();
}
if (!customMessageBox.AskAgain)
{
_manager.AppSettings.CategoryDeletePrompt = false;
_manager.SettingsDB.SaveSettings(_manager.AppSettings);
}
customMessageBox.Dispose();
}
else if (_manager.DB.RemoveCategory(category.ID))
{
RefreshCategories();
UpdateStatusBar();
}
}
示例14: CreateDatabase
private void CreateDatabase()
{
if (_manager.DB == null)
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 16, "There are problems with the database connector, this feature can't be used at the moment."),
_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
else
{
if (!CheckConnection())
return;
saveFileDialog.Title = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 17, "Create a new DOSBox Manager database");
saveFileDialog.FileName = "";
saveFileDialog.Filter = _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 15, "DOSBox Manager Database (*.dbm)|*.dbm");
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
if (!_manager.DB.CreateDB(saveFileDialog.FileName))
{
CustomMessageBox customMessageBox = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 18, "It has not been possible to create the database!"), _manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 28, "Error"), MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Error, false, false);
customMessageBox.ShowDialog();
customMessageBox.Dispose();
}
else
{
AddDBToRecentAndSetupUI(saveFileDialog.FileName, true);
}
}
}
}
示例15: btnGetGameData_Click
private void btnGetGameData_Click(object sender, EventArgs e)
{
if(_selectedGame != null){
if (_game == null || _game.GameURI != _selectedGame.Uri)
{
_game = _scraper.RetrieveGameData(_selectedGame.Uri);
if (_game == null)
return;
//Retrieving first available screenshot
if (_game.Screenshots != null && _game.Screenshots.Count > 0)
{
_scraper.DownloadFileCompleted += _scraper_DownloadFileCompleted;
_scraper.DownloadMedia(_game.Screenshots[0], Application.StartupPath + "\\tmp.img");
}
}
else if( _game != null )
{
CustomMessageBox cmb = new CustomMessageBox(_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 77, "Download Completed!!!"),
_manager.Translator.GetTranslatedMessage(_manager.AppSettings.Language, 59, "Information"),
MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Information, false, false);
cmb.ShowDialog();
cmb.Dispose();
}
}
}