static internal EmulatorDisplay Create(string filePath, int width, int height) { if (!System.IO.File.Exists(filePath)) { try{ EmulatorDisplay dd = new EmulatorDisplay(filePath); dd.Width = width; dd.Height = height; dd.Author = "Moscrif Ide Generator"; dd.Title = System.IO.Path.GetFileName(filePath); dd.Url = ""; dd.Save(); return(dd); }catch (Exception ex) { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), ex.Message, Gtk.MessageType.Error); md.ShowDialog(); return(null); } } else { //throw new FileNotFoundException(); MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), MainClass.Languages.Translate("file_notcreate_is_exist"), Gtk.MessageType.Error); md.ShowDialog(); return(null); } }
internal static EmulatorDisplay Create(string filePath,int width,int height) { if (!System.IO.File.Exists(filePath)) { try{ EmulatorDisplay dd = new EmulatorDisplay(filePath); dd.Width = width; dd.Height = height; dd.Author = "Moscrif Ide Generator"; dd.Title = System.IO.Path.GetFileName(filePath); dd.Url =""; dd.Save(); return dd; }catch(Exception ex){ MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), ex.Message, Gtk.MessageType.Error); md.ShowDialog(); return null; } } else { //throw new FileNotFoundException(); MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), MainClass.Languages.Translate("file_notcreate_is_exist"), Gtk.MessageType.Error); md.ShowDialog(); return null; } }
private void EditRule() { TreeSelection ts = tvResolution.Selection; TreeIter ti = new TreeIter(); ts.GetSelected(out ti); TreePath[] tp = ts.GetSelectedRows(); if (tp.Length < 1) return ; Rule cd = (Rule)tvResolution.Model.GetValue(ti, 3); if (cd == null) return; if(cd.Id ==-1){ MessageDialogs mdError = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("edit_resolution_system"), "", Gtk.MessageType.Error,parentWindow); mdError.ShowDialog(); return; } int width= cd.Width; int height =cd.Height; ResolutionDialog ed = new ResolutionDialog(cd,parentWindow); int result = ed.Run(); if (result == (int)ResponseType.Ok){ Rule res = ed.Resolution; if (res!= null ){ Rule cdFind = MainClass.Settings.Resolution.Rules.Find(x=>x.Id ==res.Id); if (cdFind == null){ MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("resolution_is_exist", cdFind.Name), "", Gtk.MessageType.Error,parentWindow); md.ShowDialog(); ed.Destroy(); return; } cdFind = res; resolStore.SetValues(ti,cdFind.Id,cdFind.Name,cdFind.Specific,cdFind); try{ string[] listFi = Directory.GetFiles(MainClass.Paths.DisplayDir, "*.ini"); foreach (string fi in listFi){ EmulatorDisplay dd = new EmulatorDisplay(fi); if (dd.Load()){ if (dd.Height == height && dd.Width == width){ dd.Height = res.Height; dd.Width = res.Width; dd.Save(); } } } }catch(Exception ex){ Tool.Logger.Error(ex.Message,null); MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error,parentWindow); ms.ShowDialog(); return; } } } ed.Destroy(); }