public GamesPanelsBase() { InitializeComponent(); this.Dock = DockStyle.Fill; _settings = (Settings)null; _translator = (TranslationsHelpers)null; }
public GamesPanelsBase(AppManager manager) { InitializeComponent(); this.Dock = DockStyle.Fill; _settings = manager.AppSettings; _translator = manager.Translator; }
public CategoryDialog(AppManager manager) { InitializeComponent(); _translator = manager.Translator; _AppSettings = manager.AppSettings; this.Text = _translator.GetTranslatedMessage(_AppSettings.Language, 35, "Add New Category"); _translator.TranslateUI(_AppSettings.Language, this.Name, this.Controls); }
public BaseSettingsPanel(TranslationsHelpers Translator, Settings AppSettings, string PanelName) { InitializeComponent(); this.Dock = DockStyle.Fill; _AppSettings = AppSettings; _translator = Translator; this.PanelName = PanelName; }
public GamesPanelsBase(AppManager manager, List<Game> games, Dictionary<String, Category> cats) { InitializeComponent(); this.Dock = DockStyle.Fill; _settings = manager.AppSettings; _translator = manager.Translator; _games = games; _cats = cats; }
public GamesPanel(TranslationsHelpers Translator, Settings AppSettings, string PanelName) : base(Translator, AppSettings, PanelName) { _flgInitiation = true; InitializeComponent(); _dialogsHelpers = new DialogsHelpers(); CompileUI(_AppSettings); _flgInitiation = false; }
public CategoryDialog(Helpers.Data.Objects.Settings AppSettings, TranslationsHelpers translator, Category editCat) { InitializeComponent(); _translator = translator; _AppSettings = AppSettings; this.Text = _translator.GetTranslatedMessage(_AppSettings.Language, 36, "Edit Category"); _translator.TranslateUI(_AppSettings.Language, this.Name, this.Controls); PopulateForm(editCat); }
public GamePanelBase(AppManager Manager, DialogsHelpers DialogsHelpers, Game GameData) { InitializeComponent(); _manager = Manager; _settings = _manager.AppSettings; _translator = _manager.Translator; _dialogsHelpers = DialogsHelpers; _game = GameData; }
public AppManager() { _SettingsDB = new SettingsManager("settings.dbm"); _translator = new TranslationsHelpers(_SettingsDB.LoadMessagesTranslations(), _SettingsDB.LoadComponentsTranslations()); _AppSettings = _SettingsDB.LoadSettings(); _recentDBs = _SettingsDB.LoadRecentDatabases(); _DB = new Database(); _DosBoxHelper = new DOSBoxHelpers(); _fileHelper = new FileHelpers(); }
public BehavioursPanel(TranslationsHelpers Translator, Settings AppSettings, SettingsManager SettingsDB, string PanelName) : base(Translator, AppSettings, PanelName) { _flgInitiation = true; InitializeComponent(); _helpers = new SettingsHelpers(); _dialogsHelpers = new DialogsHelpers(); _SettingsDB = SettingsDB; CompileUI(_AppSettings); _flgInitiation = false; }
public SettingsDialog(AppManager manager) { InitializeComponent(); _Settings = (Settings)manager.AppSettings.Clone(); _manager = manager; _Translator = manager.Translator; this.Text = _Translator.GetTranslatedMessage(_Settings.Language, 51, "Application Settings"); _Translator.TranslateUI(_Settings.Language, this.Name, this.Controls); InitiateUI(); }
public void Dispose() { _recentDBs = null; _translator = null; _AppSettings = null; _DosBoxHelper = null; _fileHelper = null; if(_DB != null && _DB.ConnectionStatus == System.Data.ConnectionState.Open) _DB.Disconnect(); _DB = null; if (_SettingsDB != null && _SettingsDB.ConnectionStatus == System.Data.ConnectionState.Open) _SettingsDB.Disconnect(); _SettingsDB = null; }
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; }
public String SearchDOSBox(TranslationsHelpers translator, Settings settings, bool isPortableMode) { String DOSBoxPath; DOSBoxPath = String.Empty; if (isPortableMode) { if (File.Exists(Application.StartupPath + "\\dosbox.exe")) DOSBoxPath = Application.StartupPath + "\\dosbox.exe"; else if (File.Exists(Application.StartupPath + "\\dosbox")) DOSBoxPath = Application.StartupPath + "\\dosbox"; } else { //test if DOSBox is in Program Files/DOSBox-?.?? (Windows x86) if (Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "DOSBox*", SearchOption.TopDirectoryOnly).GetLength(0) != 0) { DOSBoxPath = Directory.GetDirectories(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "DOSBox*", SearchOption.TopDirectoryOnly)[0]; if (File.Exists(DOSBoxPath + "\\dosbox.exe")) DOSBoxPath = DOSBoxPath + "\\dosbox.exe"; } else { //test if the user is using Windows x64 //in this case, DOSBox's installation directory is most likely in "Program Files (x86)" if (Directory.Exists(Environment.SystemDirectory.Substring(0, 3) + "Program Files (x86)")) { if (Directory.GetDirectories(Environment.SystemDirectory.Substring(0, 3) + "Program Files (x86)", "DOSBox*", SearchOption.TopDirectoryOnly).GetLength(0) != 0) { DOSBoxPath = Directory.GetDirectories(Environment.SystemDirectory.Substring(0, 3) + "Program Files (x86)", "DOSBox*", SearchOption.TopDirectoryOnly)[0]; if (File.Exists(DOSBoxPath + "\\dosbox.exe")) DOSBoxPath = DOSBoxPath + "\\dosbox.exe"; } } } } //if DOSBoxPath is still empty, say to the user that dosbox's executable cannot be found if (DOSBoxPath == String.Empty) { string body = translator.GetTranslatedMessage(settings.Language, 69, "DOSBox Manager cannot find DOSBox, do you want to indicate DOSBox's executable location now?"); string title = translator.GetTranslatedMessage(settings.Language, 70, "Cannot find DOSBox"); CustomMessageBox cmb = new CustomMessageBox(body, title, MessageBoxDialogButtons.YesNo, MessageBoxDialogIcon.Question, false, false); cmb.ShowDialog(); switch (cmb.Result) { case MessageBoxDialogResult.Yes: OpenFileDialog DBexeFD = new OpenFileDialog(); DBexeFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); DBexeFD.Title = translator.GetTranslatedMessage(settings.Language, 71, "Please indicate DosBox's executable location..."); DBexeFD.Filter = translator.GetTranslatedMessage(settings.Language, 72, "DosBox executable (dosbox*)|dosbox*"); if (DBexeFD.ShowDialog() == DialogResult.OK) DOSBoxPath = DBexeFD.FileName;//retrieve the selected dosbox.exe path into Amp.DBPath else DOSBoxPath = String.Empty; break; case MessageBoxDialogResult.No: DOSBoxPath = String.Empty; break; } } return DOSBoxPath; }
public void UpdateTranslations(TranslationsHelpers Translations) { //Starting updating messages translations; if (Translations.MessagesTranslations != null) { foreach (MessageTranslation msg in Translations.MessagesTranslations.Values) { if (msg.Changed) UpdateMessageTranslation(msg.ID, msg.English, msg.Italian); } } //Now I update the components translations if (Translations.ComponentsTranslations != null) { foreach (ComponentTranslation cmp in Translations.ComponentsTranslations.Values) { if (cmp.Changed) UpdateComponentTranslation(cmp.ID, cmp.English, cmp.Italian, cmp.EnglishTooltip, cmp.ItalianTooltip); } } }
public TranslationsDialog(TranslationsHelpers Translator) { InitializeComponent(); _translator = (TranslationsHelpers)Translator.Clone(); LoadPanel(1); }