示例#1
0
        void OnCreateDirectoryClicked(object sender, EventArgs a)
        {
            string      directory = "";
            EntryDialog ed        = new EntryDialog("", "New Directory");
            int         result    = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                directory = MainClass.Tools.RemoveDiacritics(ed.TextEntry);
            }
            ed.Destroy();
            if (String.IsNullOrEmpty(directory))
            {
                return;
            }

            string newFile = System.IO.Path.Combine(parent.FullName, directory);

            try {
                FileUtility.CreateDirectory(newFile);
            } catch {
                MessageDialogs md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_dir"), directory, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            FillStore(false);
        }
示例#2
0
        protected override void OnActivated()
        {
            base.OnActivated ();

            EntryDialog ed = new EntryDialog("",MainClass.Languages.Translate("line_number"),true);
            int result = ed.Run();
            if (result == (int)Gtk.ResponseType.Ok){
                if (!String.IsNullOrEmpty(ed.TextEntry) ){
                    int line = 0;

                    if(Int32.TryParse(ed.TextEntry,out line) ){

                        MainClass.MainWindow.GoToFile(null, (object)line );
                    }
                }
            }
            ed.Destroy();

            /*
            //Console.WriteLine("Action ToggleBookmarkAction activated");
            Gtk.Action act = MainClass.MainWindow.EditorNotebook.EditorAction.GetAction("sourceeditor_GoToLine");
            //Console.WriteLine("-----------");
            if (act!=null){
                //Console.WriteLine(act.Name);
                act.Activate();
                //Console.WriteLine("-----------");
            }
            */
        }
示例#3
0
        protected virtual void OnBtnAddFilterClicked(object sender, System.EventArgs e)
        {
            EntryDialog ed = new EntryDialog("",MainClass.Languages.Translate("new_filter"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    LogicalSystem cdFind = conditions.Find(x=>x.Display.ToUpper() ==newStr.ToUpper());
                    if (cdFind != null){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("filter_is_exist", cdFind.Display), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    LogicalSystem cd= new LogicalSystem();
                    cd.Display =newStr;
                    filterStore.AppendValues(cd.Display,cd);
                    conditions.Add(cd);
                }
            }
            ed.Destroy();
        }
示例#4
0
        void OnRenameItemClick(object sender, EventArgs e)
        {
            MessageDialogs md;
            string         message = "";

            if (isDir)
            {
                if ((String.IsNullOrEmpty(selectedItem)) || !Directory.Exists(selectedItem))
                {
                    md =
                        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_not_exist_f1", selectedItem), "", Gtk.MessageType.Error);
                    md.ShowDialog();
                    return;
                }
            }
            else
            {
                if ((String.IsNullOrEmpty(selectedItem)) || !File.Exists(selectedItem))
                {
                    md =
                        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_not_exist_f1", selectedItem), "", Gtk.MessageType.Error);
                    md.ShowDialog();
                    return;
                }
            }


            string oldName = System.IO.Path.GetFileName(selectedItem);

            EntryDialog ed = new EntryDialog(oldName, MainClass.Languages.Translate("new_name"));

            int result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newName = ed.TextEntry;
                string newPath = "";
                string msg     = FileUtility.RenameItem(selectedItem, isDir, newName, out newPath);

                if (!String.IsNullOrEmpty(msg))
                {
                    message = MainClass.Languages.Translate("cannot_rename_file", selectedItem);
                    if (isDir)
                    {
                        message = MainClass.Languages.Translate("cannot_rename_directory", selectedItem);
                    }

                    MessageDialogs mdd =
                        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, message, msg, Gtk.MessageType.Error);
                    mdd.ShowDialog();

                    return;
                }
            }
            ed.Destroy();
            FillStore(true);
        }
示例#5
0
        protected override void OnActivated()
        {
            base.OnActivated();

            EntryDialog ed = new EntryDialog("","New Directory");
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                if (!String.IsNullOrEmpty(ed.TextEntry) ){
                    string directory = MainClass.Tools.RemoveDiacritics(ed.TextEntry);
                    MainClass.MainWindow.CreateDirectory(directory);
                }
            }
            ed.Destroy();
            /*Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the Directory to Copy", null, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);

            if (fc.Run() == (int)ResponseType.Accept) {
                MainClass.Workspace.NewDirectory(fc.Filename);
            }
            fc.Destroy();*/
        }
示例#6
0
        protected virtual void OnBtnEditFilterClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();
            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
                return ;

            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);
            if (cd == null) return;

            EntryDialog ed = new EntryDialog(cd.Display,MainClass.Languages.Translate("new_filter"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    if (newStr == cd.Display) return;

                    LogicalSystem cdFind = conditions.Find(x=>x.Display.ToUpper() ==newStr.ToUpper());
                    if (cdFind != null){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("filter_is_exist", cdFind.Display), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    LogicalSystem cdEdited = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());

                    if (cdEdited == null){
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("unspecified_error"), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    cdEdited.Display=newStr;

                    filterStore.SetValues(ti,cdEdited.Display,cdEdited);

                    //conditions.Find(cd).Name =ed.TextEntry;
                }
            }
            ed.Destroy();
        }
示例#7
0
        protected virtual void OnBtnAddMaskClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();
            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
                return ;

            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);
            if (cd == null) return;

            EntryDialog ed = new EntryDialog("",MainClass.Languages.Translate("new_mask"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    //int maxCountRule = 0;
                    /*foreach (string rlf in cd.Mask){
                        if (maxCountRule < rlf.Id) maxCountRule = rlf.Id;
                    }*/

                    string rlFind = cd.Mask.Find(x=>x.ToUpper() ==newStr.ToUpper());
                    if (rlFind != null){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("mask_is_exist", rlFind), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    maskStore.AppendValues(newStr);

                    LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());
                    cd2.Mask.Add(newStr);
                    filterStore.SetValues(ti,cd2.Display,cd2);

                }
            }
            ed.Destroy();
        }
示例#8
0
        protected virtual void OnBtnEditCondClicked(object sender, System.EventArgs e)
        {
            if(!MainClass.LicencesSystem.CheckFunction("conditions",parentWindow)){
                return;
            }

            TreeSelection ts = tvConditions.Selection;

            TreeIter ti = new TreeIter();
            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
                return ;

            Condition cd = (Condition)tvConditions.Model.GetValue(ti, 2);
            if (cd == null) return;

            EntryDialog ed = new EntryDialog(cd.Name,MainClass.Languages.Translate("new_conditions"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    if (newStr == cd.Name) return;

                    Condition cdFind = conditions.Find(x=>x.Name.ToUpper() ==newStr.ToUpper());
                    if (cdFind != null){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("conditions_is_exist", cdFind.Name), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    Condition cdEdited = conditions.Find(x => x.Id == cd.Id);

                    if (cdEdited == null){
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("unspecified_error"), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    cdEdited.Name=newStr;

                    conditionStore.SetValues(ti,cdEdited.Id,cdEdited.Name,cdEdited);

                    //conditions.Find(cd).Name =ed.TextEntry;
                }
            }
            ed.Destroy();
        }
示例#9
0
        void OnRenameItemClick(object sender, EventArgs e)
        {
            MessageDialogs md;
            string message ="" ;

            if (isDir){

                if ((String.IsNullOrEmpty(selectedItem)) || !Directory.Exists(selectedItem)){
                    md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_not_exist_f1",selectedItem),"", Gtk.MessageType.Error);
                    md.ShowDialog();
                    return;
                }

            } else {
                if ((String.IsNullOrEmpty(selectedItem)) || !File.Exists(selectedItem)){
                    md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_not_exist_f1",selectedItem),"", Gtk.MessageType.Error);
                    md.ShowDialog();
                    return;
                }
            }

            string oldName = System.IO.Path.GetFileName(selectedItem);

            EntryDialog ed = new EntryDialog(oldName,MainClass.Languages.Translate("new_name"));

            int result = ed.Run();

            if (result == (int)ResponseType.Ok) {
                string newName = ed.TextEntry;
                string newPath ="";
                string msg = FileUtility.RenameItem(selectedItem,isDir, newName,out newPath );

                if(!String.IsNullOrEmpty(msg)){
                    message = MainClass.Languages.Translate("cannot_rename_file",selectedItem);
                    if(isDir)
                        message = MainClass.Languages.Translate("cannot_rename_directory",selectedItem);

                    MessageDialogs mdd =
                        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, message,msg, Gtk.MessageType.Error);
                    mdd.ShowDialog();

                    return;
                }
            }
            ed.Destroy();
            FillStore (true);
        }
示例#10
0
        void OnAddDirectoryClicked(object sender, EventArgs a)
        {
            TreeIter tiDirectory = new TreeIter();
            string pathDir = GetDirectory(ref tiDirectory);

            if(String.IsNullOrEmpty(pathDir)){
                return;
            }

            string directory="";
            EntryDialog ed = new EntryDialog("","New Directory");
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                directory = MainClass.Tools.RemoveDiacritics(ed.TextEntry);
            }
            ed.Destroy();
            if (String.IsNullOrEmpty(directory) ) return;

            string newDir = System.IO.Path.Combine(pathDir, directory);

            try {
                FileUtility.CreateDirectory(newDir);
            } catch {
                MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_dir"), directory, Gtk.MessageType.Error);
                md.ShowDialog();
            }

            RefreshDir(pathDir, tiDirectory);

            /*if(MainClass.Workspace != null && !String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                LoadLibs(MainClass.Workspace.RootDirectory);
            };*/
        }
示例#11
0
        protected void OnBtnEditIFiClicked(object sender, EventArgs e)
        {
            TreeSelection ts = tvIgnoreFiles.Selection;

            TreeIter ti = new TreeIter();
            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
                return ;

            IgnoreFolder iFol = (IgnoreFolder)tvIgnoreFiles.Model.GetValue(ti, 3);
            if (String.IsNullOrEmpty(iFol.Folder) ) return;

            EntryDialog ed = new EntryDialog(iFol.Folder,MainClass.Languages.Translate("new_name"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                if (!String.IsNullOrEmpty(ed.TextEntry) ){

                    iFol.Folder =ed.TextEntry;
                    storeIFi.SetValues(ti,ed.TextEntry,iFol.IsForIde,iFol.IsForPublish,iFol);
                }
            }
            ed.Destroy();
        }
示例#12
0
        protected void OnBtnAddIFiClicked(object sender, EventArgs e)
        {
            EntryDialog ed = new EntryDialog("",MainClass.Languages.Translate("name"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                if (!String.IsNullOrEmpty(ed.TextEntry) ){

                    IgnoreFolder ifol = new IgnoreFolder(ed.TextEntry,true,true);
                    storeIFi.AppendValues(ed.TextEntry,true,true,ifol);
                    ignoreFile.Add(ifol);
                }
            }
            ed.Destroy();
        }
示例#13
0
文件: MainWindow.cs 项目: moscrif/ide
    public Project RenameProject()
    {
        string appname = "";
        int typ = -1;
        Gtk.TreeIter ti = new Gtk.TreeIter();

        WorkspaceTree.GetSelectedFile(out appname, out typ, out ti);
        Project prj = MainClass.Workspace.FindProject_byApp(appname, true);

        if (prj == null)
        return null;

        EntryDialog ed = new EntryDialog(
        prj.ProjectName,
        MainClass.Languages.Translate("new_name")
        );

        int result = ed.Run();

        if (result != (int)ResponseType.Ok) {
        ed.Destroy();
        return null;
        }

        if (String.IsNullOrEmpty(ed.TextEntry)) {
            ed.Destroy();
        return null;
        }
        string newName = MainClass.Tools.RemoveDiacritics(ed.TextEntry);
        ed.Destroy();

        string oldPrjName =prj.ProjectName;

        if (newName == prj.ProjectName){
        return null;
        }

        try{
        List<string> listFile = new List<string>();
        FileUtility.GetAllFiles(ref listFile, prj.AbsolutProjectDir);

        foreach (string file in listFile)
            EditorNotebook.ClosePage(file, true);

        if(!MainClass.Workspace.RenameProject(prj,newName))
            return null;

        DropDownButton.ComboItem findProject =projectItems.FindItem(oldPrjName);
        if(findProject!=null){
            findProject.Label = prj.ProjectName;
            findProject.Item = prj;
        }
        string activeName = System.IO.Path.GetFileNameWithoutExtension(MainClass.Workspace.ActualProjectPath);
        if(activeName == oldPrjName){
            SetActualProject(prj.AbsolutAppFilePath);
        }
        }catch(Exception ex){
        Logger.Error(ex.Message);
        MessageDialogs md =
        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_rename_project",prj.ProjectName),ex.Message, Gtk.MessageType.Error);
        md.ShowDialog();

        }
        WorkspaceTree.RefreshProject(prj, ti);
        return prj;
    }
示例#14
0
文件: MainWindow.cs 项目: moscrif/ide
    public void RenameFile()
    {
        MessageDialogs md;
        string filename = "";
        int typ = -1;
        Gtk.TreeIter ti = new Gtk.TreeIter();

        WorkspaceTree.GetSelectedFile(out filename, out typ, out ti);

        if (typ == (int)TypeFile.Directory){

            if ((String.IsNullOrEmpty(filename)) || !Directory.Exists(filename)){
                md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_not_exist_f1",filename),"", Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }

        } else {
            if ((String.IsNullOrEmpty(filename)) || !File.Exists(filename)){
                md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("file_not_exist_f1",filename),"", Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }
        }
        bool isDir = (typ == (int)TypeFile.Directory)? true:false;
        string oldName = System.IO.Path.GetFileName(filename);
        EntryDialog ed = new EntryDialog(oldName,MainClass.Languages.Translate("new_name"));

        int result = ed.Run();

        if (result == (int)ResponseType.Ok) { // Rename Directory
            string newName = ed.TextEntry;
            string newPath ="";
            string msg = FileUtility.RenameItem(filename,isDir, newName,out newPath );

            if(!String.IsNullOrEmpty(msg)){
                string message = MainClass.Languages.Translate("cannot_rename_file",filename);
                if(isDir)
                    message = MainClass.Languages.Translate("cannot_rename_directory",filename);

                MessageDialogs mdd =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, message,msg, Gtk.MessageType.Error);
                mdd.ShowDialog();

                return;
            }
            if(!String.IsNullOrEmpty(newPath)){
                WorkspaceTree.UpdateIter(ti, newName, newPath, typ);
            }
        }
        ed.Destroy();
    }
示例#15
0
        protected void OnBtnAddClicked(object sender, EventArgs e)
        {
            EntryDialog ed = new EntryDialog("",MainClass.Languages.Translate("new_conditions"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    ExtensionSetting es= new ExtensionSetting();
                    es.Extension =newStr;
                    es.OpenType = ExtensionSetting.OpenTyp.TEXT;
                    resolStore.AppendValues(es.Extension,es);
                    MainClass.Settings.ExtensionList.Add(es);
                }
            }
            ed.Destroy();
        }
示例#16
0
        protected virtual void OnBtnEditMaskClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();
            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
                return ;
            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);
            if (cd == null) return;

            TreeSelection tsR = tvMask.Selection;
            TreeIter tiR = new TreeIter();
            tsR.GetSelected(out tiR);

            TreePath[] tpR = tsR.GetSelectedRows();
            if (tpR.Length < 1)
                return ;

            string rl = (string)tvMask.Model.GetValue(tiR, 0);

            EntryDialog ed = new EntryDialog(rl,MainClass.Languages.Translate("new_name"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    if(rl.ToUpper() == newStr.ToUpper()){
                        ed.Destroy();
                        return;
                    }

                    string rlFind = cd.Mask.Find(x=>x.ToUpper() ==newStr.ToUpper());
                    if (!String.IsNullOrEmpty(rlFind)){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("mask_is_exist", rlFind), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());
                    cd2.Mask.Remove(rlFind);

                    maskStore.SetValues(tiR,0,newStr,newStr);

                    cd2.Mask.Add(newStr);
                    filterStore.SetValues(ti,cd2.Display,cd2);

                }
            }
            ed.Destroy();
        }
示例#17
0
        protected virtual void OnBtnAddCondClicked(object sender, System.EventArgs e)
        {
            if(!MainClass.LicencesSystem.CheckFunction("conditions",parentWindow)){
                return;
            }

            EntryDialog ed = new EntryDialog("",MainClass.Languages.Translate("new_conditions"),parentWindow);
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    Condition cdFind = conditions.Find(x=>x.Name.ToUpper() ==newStr.ToUpper());
                    if (cdFind != null){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("conditions_is_exist", cdFind.Name), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    Condition cd= new Condition();
                    cd.Name =newStr;
                    maxCond ++;
                    cd.Id = maxCond;
                    conditionStore.AppendValues(maxCond,cd.Name,cd);
                    conditions.Add(cd);
                }
            }
            ed.Destroy();
        }
示例#18
0
        protected virtual void OnBtnEditCond1Clicked(object sender, System.EventArgs e)
        {
            if(!MainClass.LicencesSystem.CheckFunction("conditions",parentWindow)){
                return;
            }

            TreeSelection ts = tvConditions.Selection;

            TreeIter ti = new TreeIter();
            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
                return ;
            Condition cd = (Condition)tvConditions.Model.GetValue(ti, 2);
            if (cd == null) return;

            TreeSelection tsR = tvRules.Selection;
            TreeIter tiR = new TreeIter();
            tsR.GetSelected(out tiR);

            TreePath[] tpR = tsR.GetSelectedRows();
            if (tpR.Length < 1)
                return ;

            Rule rl = (Rule)tvRules.Model.GetValue(tiR, 2);

            EntryDialog ed = new EntryDialog(rl.Name,MainClass.Languages.Translate("new_name"));
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr) ){

                    Rule rlFind = cd.Rules.Find(x=>x.Name.ToUpper() ==newStr.ToUpper());
                    if (rlFind != null){

                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("rule_is_exist", rlFind.Name), "", Gtk.MessageType.Error,parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    Condition cd2 = conditions.Find(x => x.Id == cd.Id);
                    cd2.Rules.Remove(rl);

                    rl.Name =newStr;
                    ruleStore.SetValues(tiR,rl.Id,rl.Name,rl);

                    cd2.Rules.Add(rl);
                    conditionStore.SetValues(ti,cd2.Id,cd2.Name,cd2);

                    //cd.Rules.Add(rl);
                }
            }
            ed.Destroy();
        }
示例#19
0
        protected virtual void OnBtnAddClicked(object sender, System.EventArgs e)
        {
            EntryDialog ed = new EntryDialog("", MainClass.Languages.Translate("new_resolution_name"),parentWindow);

            int result = ed.Run();
            if (result == (int)ResponseType.Ok) {
                if (!String.IsNullOrEmpty(ed.TextEntry)) {
                    string nameFile = MainClass.Tools.RemoveDiacritics(ed.TextEntry);

                    string newFile = System.IO.Path.Combine(MainClass.Paths.DisplayDir, nameFile + ".ini");
                    /*if (File.Exists(newFile)) {
                        MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", "File cannot is create becaus is exist!", MessageType.Error);
                        ms.ShowDialog();
                        return;
                    }*/
                    try {
                        EmulatorDisplay dd= EmulatorDisplay.Create(newFile);

                        if (dd!= null){
                            TreeIter ti = fileListStore.AppendValues(System.IO.Path.GetFileName(newFile), newFile,dd);
                            tvFiles.Selection.SelectIter(ti);
                        }

                        //File.Create(newFile);

                    } catch (Exception ex) {

                        MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error,parentWindow);
                        ms.ShowDialog();
                        return;
                    }
                }
            }
            ed.Destroy();
        }
示例#20
0
        void OnCreateDirectoryClicked(object sender, EventArgs a)
        {
            string directory="";
            EntryDialog ed = new EntryDialog("","New Directory");
            int result = ed.Run();
            if (result == (int)ResponseType.Ok){
                directory = MainClass.Tools.RemoveDiacritics(ed.TextEntry);
            }
            ed.Destroy();
            if (String.IsNullOrEmpty(directory) ) return;

            string newFile = System.IO.Path.Combine(parent.FullName, directory);

            try {
                FileUtility.CreateDirectory(newFile);
            } catch {
                MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_dir"), directory, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            FillStore (false);
        }