示例#1
0
        /*			if((fa & FileAttributes.Directory) == FileAttributes.ReadOnly)
         *              editor.Document.ReadOnly= true;*/
        public bool Save()
        {
            if (onlyRead)
            {
                return(false);
            }

            if (!modified)
            {
                return(true);
            }
            try {
                using (StreamWriter file = new StreamWriter(fileName)) {
                    file.Write(editor.Document.Text);
                    file.Close();
                    file.Dispose();
                }
                OnModifiedChanged(false);
            } catch (Exception ex) {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_save_file", fileName), ex.Message, Gtk.MessageType.Error);
                ms.ShowDialog();
                return(false);
            }
            // do save
            return(true);
            // alebo true ak je OK
        }
示例#2
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if(String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_not_exist"), MainClass.Languages.Translate("please_create_workspace"), Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("chose_project_import"), MainClass.MainWindow, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);

            if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedImportDir))
                fc.SetCurrentFolder(MainClass.Settings.LastOpenedImportDir);

            FileFilter filter = new FileFilter();
            filter.Name = "zip files";
            filter.AddMimeType("zip file");
            filter.AddPattern("*.zip");
            fc.AddFilter(filter);

            if (fc.Run() == (int)ResponseType.Accept) {

                MainClass.Settings.LastOpenedImportDir = System.IO.Path.GetDirectoryName(fc.Filename);

                MainClass.MainWindow.ImportProject(fc.Filename,true);
            }

            fc.Destroy();
        }
示例#3
0
        public bool SaveAs(string newPath)
        {
            if (File.Exists(newPath))
            {
                MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, "", MainClass.Languages.Translate("overwrite_file", newPath), Gtk.MessageType.Question);
                int            result = md.ShowDialog();

                if (result != (int)Gtk.ResponseType.Yes)
                {
                    return(false);
                }
            }

            try {
                using (StreamWriter file = new StreamWriter(newPath)) {
                    file.Write(editor.Document.Text);
                    file.Close();
                    file.Dispose();
                }
                OnModifiedChanged(false);

                fileName = newPath;
                onlyRead = false;
            } catch (Exception ex) {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_save_file", newPath), ex.Message, Gtk.MessageType.Error);
                ms.ShowDialog();
                return(false);
            }
            // do save
            return(true);
            // alebo true ak je OK
        }
示例#4
0
        protected void OnBtnNextClicked(object sender, EventArgs e)
        {
            if (notebook1.Page == 0)
            {
                //btnResetMatrix.Visib
                List <CombinePublish> list = project.ProjectUserSetting.CombinePublish.FindAll(x => x.IsSelected == true);

                if (list == null || list.Count < 1)
                {
                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("pleas_select_application"), "", Gtk.MessageType.Error, this);
                    md.ShowDialog();
                    return;
                }
                int selectTyp = (int)ddbTypPublish.CurrentItem;

                if ((selectTyp != 0) && (MainClass.Workspace.SignApp))
                {
                    if (!LogginAndVerification())
                    {
                        return;
                    }
                }
                notebook1.Page           = 1;
                btnResetMatrix.Sensitive = false;
                btnNext.Sensitive        = false;
                btnCancel.Label          = "_Close";
                RunPublishTask(list);
            }
        }
示例#5
0
        protected void OnBtnDeleteIFiClicked(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 (iFol == null)
            {
                return;
            }

            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_resolution", iFol.Folder), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }

            ignoreFile.Remove(iFol);
            storeIFi.Remove(ref ti);
        }
示例#6
0
        public Project OpenProject(string filename, bool showError, bool throwError)
        {
            Project p = FindProject(filename);

            if (p == null)
            {
                p = Project.OpenProject(filename, showError, throwError);

                if (p != null)
                {
                    Projects.Add(p);
                    ProjectsFile.Add(GetRelativePath(p.FilePath));
                    return(p);
                }
            }
            else
            {
                if (showError)
                {
                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("project_is_opened", p.ProjectName), null, Gtk.MessageType.Error, null);
                    md.ShowDialog();
                }
                else if (throwError)
                {
                    throw new Exception(MainClass.Languages.Translate("project_is_opened", p.ProjectName));
                }
                return(null);
            }
            return(null);
        }
示例#7
0
 static internal Workspace OpenWorkspace(string filePath)
 {
     if (System.IO.File.Exists(filePath))
     {
         try {
             using (FileStream fs = File.OpenRead(filePath)) {
                 XmlSerializer serializer = new XmlSerializer(typeof(Workspace));
                 Workspace     w          = (Workspace)serializer.Deserialize(fs);
                 w.FilePath = filePath;
                 return(w);
             }
         } catch (Exception ex) {
             MessageDialogs md =
                 new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_is_corrupted"), ex.Message, Gtk.MessageType.Error, null);
             md.ShowDialog();
             return(null);
         }
     }
     else
     {
         //throw new FileNotFoundException();
         MessageDialogs md =
             new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "", MainClass.Languages.Translate("workspace_is_corrupted"), Gtk.MessageType.Error, null);
         md.ShowDialog();
         return(null);
     }
 }
示例#8
0
        protected override void OnActivated()
        {
            base.OnActivated();


            if (String.IsNullOrEmpty(MainClass.Workspace.FilePath))
            {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_not_exist"), MainClass.Languages.Translate("please_create_workspace"), Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("chose_project_import"), MainClass.MainWindow, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);

            if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedImportDir))
            {
                fc.SetCurrentFolder(MainClass.Settings.LastOpenedImportDir);
            }

            FileFilter filter = new FileFilter();

            filter.Name = "zip files";
            filter.AddMimeType("zip file");
            filter.AddPattern("*.zip");
            fc.AddFilter(filter);

            if (fc.Run() == (int)ResponseType.Accept)
            {
                MainClass.Settings.LastOpenedImportDir = System.IO.Path.GetDirectoryName(fc.Filename);

                MainClass.MainWindow.ImportProject(fc.Filename, true);
            }

            fc.Destroy();
        }
示例#9
0
        public string CreateDirectory(string Filename, string selectedDir, int selectedTyp)
        {
            string filename = System.IO.Path.GetFileName(Filename);
            string newFile  = "";

            if (selectedTyp == (int)TypeFile.AppFile)
            {
                Project prj = FindProject_byApp(selectedDir, true);
                if (prj == null)
                {
                    return(String.Empty);
                }

                newFile     = System.IO.Path.Combine(prj.AbsolutProjectDir, filename);
                selectedDir = prj.AbsolutProjectDir;
            }
            else
            {
                newFile = System.IO.Path.Combine(selectedDir, filename);
            }

            try {
                FileUtility.CreateDirectory(newFile);
            } catch {
                MessageDialogs md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_dir"), filename, Gtk.MessageType.Error);
                md.ShowDialog();
                return(String.Empty);
            }
            return(newFile);
        }
示例#10
0
        protected void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            string message = "";

            if (String.IsNullOrEmpty(entrName.Text))
            {
                message = MainClass.Languages.Translate("new_resolution_error_f1");
            }

            if (String.IsNullOrEmpty(entrSpecific.Text))
            {
                message = MainClass.Languages.Translate("new_resolution_error_f2");
            }

            if ((sbWidth.Value < 1) || (sbHeight.Value < 1))
            {
                message = MainClass.Languages.Translate("new_resolution_error_f3");
            }

            if (!String.IsNullOrEmpty(message))
            {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, message, "", Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }
            resolution.Name     = entrName.Text;
            resolution.Specific = entrSpecific.Text;
            resolution.Width    = (int)sbWidth.Value;
            resolution.Height   = (int)sbHeight.Value;

            this.Respond(ResponseType.Ok);
        }
示例#11
0
        protected virtual void OnBtnDeleteFilterClicked(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;
            }

            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_filter", cd.Display), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }

            conditions.Remove(cd);
            maskStore.Clear();
            filterStore.Remove(ref ti);
        }
示例#12
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();
        }
示例#13
0
        protected void OnBtnDeleteClicked(object sender, EventArgs e)
        {
            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("are_you_sure"), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }

            TreeSelection ts = tvExtension.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

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

            MainClass.Settings.ExtensionList.Remove(selectedExtensionSetting);
            resolStore.Remove(ref ti);
            tvExtension.Selection.SelectPath(new TreePath("0"));
        }
示例#14
0
 internal void SaveProject(Project p)
 {
     try {
         /*XmlWriterSettings xmlSettings = new XmlWriterSettings();
          *
          * xmlSettings.NewLineChars = "\n";//Environment.NewLine;
          * xmlSettings.Indent = true;
          * xmlSettings.CloseOutput = true;
          *
          * XmlSerializer x_serial = new XmlSerializer( typeof( Project ) );
          * using (XmlWriter wr = XmlWriter.Create( p.FilePath, xmlSettings )) {
          *  x_serial.Serialize( wr, p );
          * }
          *
          * XmlSerializer x_serial_PU = new XmlSerializer( typeof( ProjectUserFile ) );
          * using (XmlWriter wr = XmlWriter.Create( p.ProjectUserSetting.FilePath, xmlSettings )) {
          *  x_serial_PU.Serialize( wr, p.ProjectUserSetting );
          * }*/
         p.Save();
     } catch (Exception ex) {
         MessageDialogs md =
             new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_saving"), ex.Message, Gtk.MessageType.Error);
         md.ShowDialog();
     }
 }
示例#15
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();
        }
示例#16
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if(String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_not_exist"), MainClass.Languages.Translate("please_create_workspace"), Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("save_project_export"), MainClass.MainWindow, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept);

            if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedExportDir))
                fc.SetCurrentFolder(MainClass.Settings.LastOpenedExportDir);

            FileFilter filter = new FileFilter();
            filter.Name = "zip files";
            filter.AddMimeType("zip file");
            filter.AddPattern("*.zip");
            fc.AddFilter(filter);

            string appname = "";
            int typ = -1;
            Gtk.TreeIter ti = new Gtk.TreeIter();
            MainClass.MainWindow.WorkspaceTree.GetSelectedFile(out appname, out typ, out ti);

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

            Project p = MainClass.Workspace.FindProject_byApp(appname, true);

            if(p== null){
                return;
            }

            fc.CurrentName =p.ProjectName+"_"+p.AppFile.Version.Replace(".","_") ;
            //fc.SetFilename(p.ProjectName);

            if (fc.Run() != (int)ResponseType.Accept) {
                fc.Destroy();
                return;
            }

            string name =fc.Filename;

            string ext = System.IO.Path.GetExtension(name);

            if(ext.ToLower() != ".zip"){
                name = name+".zip";
            }

            if(p!= null){
                p.Export(name,true);
                MainClass.Settings.LastOpenedExportDir = System.IO.Path.GetDirectoryName(fc.Filename);
            }
            fc.Destroy();
        }
示例#17
0
        protected virtual void OnBtnDeleteCond1Clicked(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);

            if (rl == null)
            {
                return;
            }


            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_rule", rl.Name), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }
            ruleStore.Remove(ref tiR);

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

            cd2.Rules.Remove(rl);
            conditionStore.SetValues(ti, cd2.Id, cd2.Name, cd2);
        }
示例#18
0
 private bool CheckSelectTable()
 {
     if (String.IsNullOrEmpty(curentTable))
     {
         MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("please_select_table"), "", MessageType.Error, null);
         ms.ShowDialog();
         return(false);
     }
     return(true);
 }
示例#19
0
        protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            if (MainClass.Settings.ClearConsoleBeforRuning)
            {
                MainClass.MainWindow.OutputConsole.Clear();
            }

            if (MainClass.Workspace.SignApp)
            {
                LoggUser vc = new LoggUser();

                if ((MainClass.User == null) || (string.IsNullOrEmpty(MainClass.User.Token)))
                {
                    LoginRegisterDialog ld = new LoginRegisterDialog(this);
                    int res = ld.Run();

                    if (res == (int)Gtk.ResponseType.Cancel)
                    {
                        ld.Destroy();
                        return;
                    }
                    ld.Destroy();
                    return;
                }

                if (!vc.Ping(MainClass.User.Token))
                {
                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("invalid_login_f1"), "", Gtk.MessageType.Error, this);
                    md.ShowDialog();

                    LoginRegisterDialog ld = new LoginRegisterDialog(this);
                    int res = ld.Run();
                    if (res == (int)Gtk.ResponseType.Cancel)
                    {
                        ld.Destroy();
                        return;
                    }
                    ld.Destroy();
                    return;
                }
            }

            List <CombinePublish> list = project.ProjectUserSetting.CombinePublish.FindAll(x => x.IsSelected == true);

            if (list == null || list.Count < 1)
            {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("pleas_select_application"), "", Gtk.MessageType.Error, this);
                md.ShowDialog();
                return;
            }
            RunPublishTask(list);

            this.Respond(ResponseType.Ok);
        }
示例#20
0
        protected virtual void OnBtnDeleteMaskClicked(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);

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


            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_mask", rl), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }
            maskStore.Remove(ref tiR);

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

            cd2.Mask.Remove(rl);
            filterStore.SetValues(ti, cd2.Display, cd2);
        }
示例#21
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();
        }
示例#22
0
        public bool RenameProject(Project prj, string newName)
        {
            string newDir     = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, newName);
            string newApp     = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, newName + ".app");
            string newPrj     = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, newName + ".msp");
            string oldPrjName = prj.ProjectName;

            if (File.Exists(newApp) || File.Exists(newPrj) || Directory.Exists(newDir))
            {
                MessageDialogs md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_rename_project", prj.ProjectName), MainClass.Languages.Translate("project_exist"), Gtk.MessageType.Error);
                md.ShowDialog();
                return(false);
            }

            string oldPrjFile = prj.FilePath;

            System.IO.File.Move(prj.AbsolutAppFilePath, newApp);
            System.IO.File.Move(prj.FilePath, newPrj);
            System.IO.Directory.Move(prj.AbsolutProjectDir, newDir);

            prj.AppFilePath = GetRelativePath(newApp);
            prj.FilePath    = newPrj;

            foreach (FileItem fi in prj.FilesProperty)
            {
                fi.FilePath = fi.FilePath.Replace("./" + oldPrjName + "/", "./" + newName + "/");
                fi.FilePath = fi.FilePath.Replace(".\\" + oldPrjName + "\\", ".\\" + newName + "\\");
                //MainClass.Workspace.GetRelativePath(d.FullName);
            }

            SaveProject(prj);

            ProjectsFile.Remove(GetRelativePath(oldPrjFile));
            ProjectsFile.Add(GetRelativePath(prj.FilePath));

            Devices.Device dev = prj.DevicesSettings.Find(x => x.Devicetype == DeviceType.iOS_5_0);
            if (dev != null)
            {
                Devices.PublishProperty pp = dev.PublishPropertisMask.Find(x => x.PublishName == Project.KEY_BUNDLEIDENTIFIER);
                if (pp != null)
                {
                    pp.PublishValue.Replace(oldPrjName, newName);
                }
            }
            return(true);
        }
示例#23
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if (String.IsNullOrEmpty(MainClass.Workspace.FilePath))
            {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("please_create_workspace"), "", Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }

            OpenProjectDialog nfd = new OpenProjectDialog();

            int result = nfd.Run();

            if (result == (int)ResponseType.Ok)
            {
                //string fileName = nfd.FileName;
                //MainClass.MainWindow.CreateFile(fileName);
            }
            nfd.Destroy();
            MainClass.MainWindow.SaveWorkspace();
            return;

            /*
             * Gtk.FileChooserDialog fc=
             * new Gtk.FileChooserDialog("Choose the project to open",
             *                  MainClass.MainWindow,
             *                  FileChooserAction.Open,
             *                  "Cancel",ResponseType.Cancel,
             *                  "Open",ResponseType.Accept);
             *
             * FileFilter filter = new FileFilter();
             * filter.Name = "Project files";
             * filter.AddMimeType("Project file");
             * filter.AddPattern("*.msp");
             * fc.AddFilter(filter);
             * fc.SetCurrentFolder(MainClass.Workspace.RootDirectory);
             *
             * if (fc.Run() == (int)ResponseType.Accept){
             *      MainClass.MainWindow.OpenProject(fc.Filename,true);
             * }
             *
             * fc.Destroy();
             * MainClass.MainWindow.SaveWorkspace();*/
        }
示例#24
0
        public bool Validate()
        {
            //return true;

            if ((String.IsNullOrEmpty(feLib.Path)) ||
                (String.IsNullOrEmpty(fePublishTool.Path)) ||
                (String.IsNullOrEmpty(feEmulator.Path))
                )
            {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", MainClass.Languages.Translate("please_set_all_folder"), MessageType.Error);
                ms.ShowDialog();
                return(false);
            }


            return(true);
        }
示例#25
0
        protected override void OnActivated()
        {
            base.OnActivated ();

            if (String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("please_create_workspace"), "", Gtk.MessageType.Error);
                md.ShowDialog();
                return;

            }

            OpenProjectDialog nfd = new OpenProjectDialog();

            int result = nfd.Run();
            if (result == (int)ResponseType.Ok) {

                //string fileName = nfd.FileName;
                //MainClass.MainWindow.CreateFile(fileName);
            }
            nfd.Destroy();
            MainClass.MainWindow.SaveWorkspace();
            return;

            /*
            Gtk.FileChooserDialog fc=
            new Gtk.FileChooserDialog("Choose the project to open",
                                    MainClass.MainWindow,
                                    FileChooserAction.Open,
                                    "Cancel",ResponseType.Cancel,
                                    "Open",ResponseType.Accept);

            FileFilter filter = new FileFilter();
            filter.Name = "Project files";
            filter.AddMimeType("Project file");
            filter.AddPattern("*.msp");
            fc.AddFilter(filter);
            fc.SetCurrentFolder(MainClass.Workspace.RootDirectory);

            if (fc.Run() == (int)ResponseType.Accept){
                MainClass.MainWindow.OpenProject(fc.Filename,true);
            }

            fc.Destroy();
            MainClass.MainWindow.SaveWorkspace();*/
        }
示例#26
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if (MainClass.Workspace.ActualProject == null){
                    MessageDialogs md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Please, select project.", "", Gtk.MessageType.Error);
                    md.ShowDialog();
                return;
            }

            PreferencesDialog pd = new PreferencesDialog(TypPreferences.ProjectSetting,MainClass.Workspace.ActualProject,MainClass.Workspace.ActualProject.ProjectName);
            int result = pd.Run();
            if (result == (int)ResponseType.Ok) {
                MainClass.Workspace.SaveProject(MainClass.Workspace.ActualProject);
            }
            pd.Destroy();
        }
示例#27
0
        protected void OnBtnResetIFiClicked(object sender, EventArgs e)
        {
            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("question_default_ignorelist"), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }

            MainClass.Settings.GenerateIgnoreFiles();
            storeIFi.Clear();

            foreach (IgnoreFolder ignoref in MainClass.Settings.IgnoresFiles)
            {
                storeIFi.AppendValues(ignoref.Folder, ignoref.IsForIde, ignoref.IsForPublish, ignoref);
            }
        }
示例#28
0
        public Project CloseProject(string appFile)
        {
            Project p = FindProject_byApp(appFile, true);

            if (p != null)
            {
                Projects.Remove(p);
                ProjectsFile.Remove(GetRelativePath(p.FilePath));
                SaveProject(p);
                return(p);
            }
            else
            {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("project_not_exit"), null, Gtk.MessageType.Error);
                md.ShowDialog();
                return(null);
            }
        }
示例#29
0
        private void Save(bool question)
        {
            if (question)
            {
                MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("question_save_resolution", selectedResolDisplay.Title), MainClass.Languages.Translate("changes_will_be_lost"), Gtk.MessageType.Question, parentWindow);
                int            result = md.ShowDialog();

                if (result != (int)Gtk.ResponseType.Yes)
                {
                    isChange = false;
                    return;
                }
            }

            /*TreeSelection ts = tvFiles.Selection;
             *
             * TreeIter ti = new TreeIter();
             * ts.GetSelected(out ti);
             *
             * TreePath[] tp = ts.GetSelectedRows();
             * if (tp.Length < 1)
             *      return ;
             *
             * ResolutionDisplay dd=  (ResolutionDisplay)tvFiles.Model.GetValue(ti, 2);
             */
            if (selectedResolDisplay == null)
            {
                return;
            }

            selectedResolDisplay.Height = (int)sbHeight.Value;
            selectedResolDisplay.Width  = (int)sbWidth.Value;

            selectedResolDisplay.Title  = String.IsNullOrEmpty(entTitle.Text)?" ":entTitle.Text;
            selectedResolDisplay.Author = String.IsNullOrEmpty(entAuthor.Text)?" ":entAuthor.Text;
            selectedResolDisplay.Url    = String.IsNullOrEmpty(entUrl.Text)?" ":entUrl.Text;
            selectedResolDisplay.Tablet = chbTablet.Active;

            selectedResolDisplay.Save();
            fileListStore.SetValue(selectedTreeIter, 2, selectedResolDisplay);
            //fileListStore.SetValue(ti,2,dd);

            isChange = false;
        }
示例#30
0
        void OnAddFileClicked(object sender, EventArgs a)
        {
            TreeIter tiDirectory = new TreeIter();
            string   pathDir     = GetDirectory(ref tiDirectory);

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

            string fileName = "";
            string content  = "";

            NewFileDialog nfd = new NewFileDialog();

            int result = nfd.Run();

            if (result == (int)ResponseType.Ok)
            {
                fileName = nfd.FileName;
                content  = nfd.Content;
            }
            nfd.Destroy();
            if (String.IsNullOrEmpty(fileName))
            {
                return;
            }

            string newFile = System.IO.Path.Combine(pathDir, fileName);

            try {
                FileUtility.CreateFile(newFile, content);
            } catch {
                MessageDialogs md =
                    new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            RefreshDir(pathDir, tiDirectory);

            /*if(MainClass.Workspace != null && !String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
             *      LoadLibs(MainClass.Workspace.RootDirectory);
             * };*/
        }
示例#31
0
        private void GetTables()
        {
            tableModel.Clear();
            tablesComboModel.Clear();
            SqliteConnection conn = (SqliteConnection)sqlLiteDal.GetConnect();
            SqliteDataReader dr   = null;

            try {
                //conn.Open();
                using (SqliteCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "SELECT name,sql FROM sqlite_master WHERE type='table' ORDER BY name;";
                    dr = cmd.ExecuteReader();
                }

                if (dr.HasRows)
                {
                    //int fieldcount = dr.FieldCount;
                    int cnt = -1;
                    while (dr.Read())
                    {
                        string name   = dr[0].ToString();
                        string schema = dr[1].ToString();
                        tablesComboModel.AppendValues(name, schema);
                        cnt++;
                    }
                    cbTable.Active = cnt;
                    countTables    = cnt;
                }
            } catch (Exception ex) {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error, null);
                ms.ShowDialog();
            } finally {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
                conn.Close();
                conn = null;;
            }
        }
示例#32
0
        private bool CheckMessage()
        {
            if (!generatePublishList)
            {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("are_you_sure"), MainClass.Languages.Translate("change_name_deleted_publish_list"), MessageType.Question, parentWindow);

                int result = ms.ShowDialog();


                if (result == (int)ResponseType.No)
                {
                    checkChange   = false;
                    entrName.Text = projectArtefact;
                    checkChange   = true;
                    return(false);
                }
                generatePublishList = true;
            }
            return(true);
        }
示例#33
0
        protected void OnBtnAddRulesClicked(object sender, System.EventArgs e)
        {
            ResolutionDialog ed = new ResolutionDialog(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.Name.ToUpper() == res.Name.ToUpper());
                    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;
                    }

                    maxCond++;
                    res.Id = maxCond;
                    resolStore.AppendValues(res.Id, res.Name, res.Specific, res);
                    MainClass.Settings.Resolution.Rules.Add(res);

                    if (ed.CreateFile)
                    {
                        try{
                            string newFile = System.IO.Path.Combine(MainClass.Paths.DisplayDir, res.Name + ".ini");
                            EmulatorDisplay.Create(newFile, res.Width, res.Height);
                        }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();
        }
示例#34
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if (MainClass.Settings.ClearConsoleBeforRuning)
            {
                MainClass.MainWindow.OutputConsole.Clear();
            }

            MainClass.MainWindow.ProcessOutput.Clear();
            MainClass.MainWindow.ErrorOutput.Clear();
            MainClass.MainWindow.LogOutput.Clear();

            if (MainClass.Workspace.ActualProject == null)
            {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", MainClass.Languages.Translate("no_project_selected"), MessageType.Error);
                ms.ShowDialog();
                return;
            }

            PublishDialogWizzard npw = new PublishDialogWizzard();
            int result = npw.Run();

            if (result == (int)ResponseType.Ok)
            {
            }
            npw.Destroy();

            /*PublishDialog pd = new PublishDialog();
             * if(pd.Run() == (int)ResponseType.Ok){
             *
             * }
             * pd.Destroy();*/

            /*TaskList tl = new TaskList();
             * tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>();
             * tl.TasksList.Add(new PublishTask() );
             *
             * MainClass.MainWindow.RunTaskList(tl,false);
             */
        }
示例#35
0
        protected void OnBtnAddRulesClicked(object sender, System.EventArgs e)
        {
            ResolutionDialog ed = new ResolutionDialog(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.Name.ToUpper() ==res.Name.ToUpper());
                    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;
                    }

                    maxCond ++;
                    res.Id = maxCond;
                    resolStore.AppendValues(res.Id,res.Name,res.Specific,res);
                    MainClass.Settings.Resolution.Rules.Add(res);

                    if(ed.CreateFile){
                        try{
                            string newFile = System.IO.Path.Combine(MainClass.Paths.DisplayDir, res.Name + ".ini");
                            EmulatorDisplay.Create(newFile,res.Width,res.Height);
                        }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();
        }
示例#36
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if (MainClass.Settings.ClearConsoleBeforRuning)
                MainClass.MainWindow.OutputConsole.Clear();

            MainClass.MainWindow.ProcessOutput.Clear();
            MainClass.MainWindow.ErrorOutput.Clear();
            MainClass.MainWindow.LogOutput.Clear();

            if(MainClass.Workspace.ActualProject == null){
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", MainClass.Languages.Translate("no_project_selected"), MessageType.Error);
                ms.ShowDialog();
                return;
            }

            PublishDialogWizzard npw = new PublishDialogWizzard();
            int result = npw.Run();
            if (result == (int)ResponseType.Ok) {

            }
            npw.Destroy();

            /*PublishDialog pd = new PublishDialog();
            if(pd.Run() == (int)ResponseType.Ok){

            }
            pd.Destroy();*/

            /*TaskList tl = new TaskList();
            tl.TasksList = new System.Collections.Generic.List<Moscrif.IDE.Task.ITask>();
            tl.TasksList.Add(new PublishTask() );

            MainClass.MainWindow.RunTaskList(tl,false);
             */
        }
示例#37
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();
        }
示例#38
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();
        }
示例#39
0
        public StructureDatabaseView(string fileName)
        {
            this.filename = fileName;

            hbox = new HBox();

            sqlLiteDal = new SqlLiteDal(fileName);

            lblTable = new Label( MainClass.Languages.Translate("tables"));
            hbox.PackStart(lblTable, false, false, 10);

            cbTable = new ComboBox();
            cbTable.Changed += new EventHandler(OnComboProjectChanged);

            CellRendererText textRenderer = new CellRendererText();
            cbTable.PackStart(textRenderer, true);
            cbTable.AddAttribute(textRenderer, "text", 0);
            cbTable.Model = tablesComboModel;
            cbTable.WidthRequest = 200;

            hbox.PackStart(cbTable, false, false, 2);
            hbox.PackEnd(new Label(""), true, true, 2);

            HButtonBox hbbAction = new HButtonBox();
            hbbAction.LayoutStyle = Gtk.ButtonBoxStyle.Start;
            hbbAction.Spacing =6;

            Button btnAddTable = new Button(MainClass.Languages.Translate("add_table"));
            btnAddTable.Clicked+= delegate(object sender, EventArgs e) {

                SqlLiteAddTable addtable = new SqlLiteAddTable( filename );
                int result = addtable.Run();
                if (result == (int)ResponseType.Ok) {
                    GetTables();
                }
                addtable.Destroy();
            };

            Button btnDeleteTable = new Button(MainClass.Languages.Translate("delete_table"));
            btnDeleteTable.Clicked+= delegate(object sender, EventArgs e) {

                if(!CheckSelectTable())  return;

                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo,MainClass.Languages.Translate("permanently_delete_table", curentTable), "", Gtk.MessageType.Question);
                int result = md.ShowDialog();
                if (result != (int)Gtk.ResponseType.Yes)
                    return;

                DropTable();
                GetTables();
            };

            Button btnEditTable = new Button(MainClass.Languages.Translate("edit_table"));
            btnEditTable.Clicked+= delegate(object sender, EventArgs e) {

                if(!CheckSelectTable())  return;

                SqlLiteEditTable editTable = new SqlLiteEditTable(filename,curentTable);
                int result = editTable.Run();
                if (result == (int)ResponseType.Ok) {
                    GetTables();
                }
                editTable.Destroy();
            };

            hbbAction.Add(btnAddTable);
            hbbAction.Add(btnDeleteTable);
            hbbAction.Add(btnEditTable);
            hbox.PackEnd(hbbAction, false, false, 10);

            this.PackStart(hbox, false, false, 5);

            ScrolledWindow sw = new ScrolledWindow();
            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            treeView = new TreeView(tableModel);
            GenerateColumns();
            treeView.RulesHint = true;
            //treeView.SearchColumn = (int) Column.Description;
            sw.Add(treeView);

            this.PackStart(sw, true, true, 5);

            ScrolledWindow sw2 = new ScrolledWindow ();
            sw2.ShadowType = ShadowType.EtchedIn;
            sw2.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            sw2.HeightRequest = 50;

            textControl = new TextView();
            textControl.Editable = false;
            textControl.HeightRequest = 50;
            sw2.Add (textControl);
            this.PackEnd(sw2, false, false, 5);

            this.ShowAll();
            GetTables();
            //cbTable.Active = 0;
        }
示例#40
0
        private void GetTables()
        {
            tableModel.Clear();
            tablesComboModel.Clear();
            SqliteConnection conn = (SqliteConnection)sqlLiteDal.GetConnect();
                SqliteDataReader dr = null;
            try {
                        //conn.Open();
                        using (SqliteCommand cmd = conn.CreateCommand())
                        {
                            cmd.CommandText = "SELECT name,sql FROM sqlite_master WHERE type='table' ORDER BY name;";
                            dr = cmd.ExecuteReader();
                        }

                if (dr.HasRows)
                        {
                            //int fieldcount = dr.FieldCount;
                    int cnt = -1;
                            while (dr.Read())
                            {
                             	string name = dr[0].ToString();
                    string schema = dr[1].ToString();
                    tablesComboModel.AppendValues(name, schema);
                    cnt++;
                            }
                    cbTable.Active = cnt;
                    countTables = cnt;
                        }

            } catch (Exception ex) {

                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error,null);
                ms.ShowDialog();

            } finally {
                if (dr != null) dr.Close();
                dr = null;
                conn.Close();
                conn = null;;
            }
        }
示例#41
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();
        }
示例#42
0
 private void ShowInfo(string error1, string error2)
 {
     MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok,error1, error2, Gtk.MessageType.Info,ParentWindow);
     md.ShowDialog();
 }
示例#43
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);
            };*/
        }
示例#44
0
        private bool CheckMessage()
        {
            if (!generatePublishList) {

                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("are_you_sure"),  MainClass.Languages.Translate("change_name_deleted_publish_list"), MessageType.Question,parentWindow);

                int result =ms.ShowDialog();

                if (result == (int)ResponseType.No){
                    checkChange = false;
                    entrName.Text=projectArtefact;
                    checkChange = true;
                    return false;
                }
                generatePublishList = true;

            }
            return true;
        }
示例#45
0
        public bool Validate()
        {
            if (String.IsNullOrEmpty(feOutput.Path) || String.IsNullOrEmpty(entrName.Text)) {

                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), MainClass.Languages.Translate("please_set_all_Folders"), MessageType.Error,parentWindow);
                ms.ShowDialog();
                return false;
            }
            //Console.WriteLine(feOutput.Path);
            //Console.WriteLine(project.ConvertProjectMaskPathToFull(feOutput.Path));
            //Console.WriteLine(project.AbsolutProjectDir);
            string outputPath =project.ConvertProjectMaskPathToFull(feOutput.Path);

            bool cointaint =  FileUtility.ContainsPath(project.AbsolutProjectDir,outputPath);

            if(cointaint){
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error"), MainClass.Languages.Translate("output_overlap_project"), MessageType.Error,parentWindow);
                ms.ShowDialog();
                return false;
            }

            return true;
        }
示例#46
0
        protected void OnBtnNextClicked(object sender, EventArgs e)
        {
            if(notebook1.Page == 0){
                //btnResetMatrix.Visib
                List<CombinePublish> list =project.ProjectUserSetting.CombinePublish.FindAll(x=>x.IsSelected==true);

                if(list==null || list.Count<1){
                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("pleas_select_application"), "", Gtk.MessageType.Error,this);
                    md.ShowDialog();
                    return;
                }
                int selectTyp =  (int)ddbTypPublish.CurrentItem;

                if((selectTyp != 0) && (MainClass.Workspace.SignApp)){
                    if(!LogginAndVerification()){
                        return;
                    }
                }
                notebook1.Page = 1;
                btnResetMatrix.Sensitive = false;
                btnNext.Sensitive = false;
                btnCancel.Label = "_Close";
                RunPublishTask(list);
            }
        }
示例#47
0
文件: Project.cs 项目: moscrif/ide
        internal static Project OpenProject(string filePath,bool showError,bool throwError)
        {
            if (System.IO.File.Exists(filePath)){

                try{

                    using (FileStream fs = File.OpenRead(filePath)) {
                        XmlSerializer serializer = new XmlSerializer(typeof(Project));

                        Project p = (Project)serializer.Deserialize(fs);
                            p.FilePath = filePath;

                        if(!System.IO.File.Exists(p.AbsolutAppFilePath)){
                                if(showError){
                                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("project_is_corrupted_f2", filePath), "", Gtk.MessageType.Error,null);
                                    md.ShowDialog();
                                } else if(throwError){
                                    throw new Exception(MainClass.Languages.Translate("project_is_corrupted_f2", filePath));
                                }
                            return null;
                        }
                        return p;
                    }
                }catch(Exception ex){

                    Tool.Logger.Error(ex.Message);

                    if(throwError){
                        throw ex;
                    }

                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.OkCancel, MainClass.Languages.Translate("project_is_corrupted", filePath), MainClass.Languages.Translate("delete_corupted_project"), Gtk.MessageType.Question,null);
                    int res = md.ShowDialog();
                    if(res == (int)Gtk.ResponseType.Ok) {
                        try{
                            System.IO.File.Delete(filePath);
                        }catch(Exception exx){
                            MessageDialogs mdError = new MessageDialogs(MessageDialogs.DialogButtonType.OkCancel, "Error", exx.Message, Gtk.MessageType.Error,null);
                            mdError.ShowDialog();
                            }
                        }
                    return null;

                }
            }else {
                if(showError){
                    MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("project_not_exit_f1", filePath), "", Gtk.MessageType.Error,null);
                    md.ShowDialog();
                } if(throwError){
                    throw new Exception(MainClass.Languages.Translate("project_is_corrupted_f2", filePath));
                }
                return null;
            }
        }
示例#48
0
        private void Save(bool question)
        {
            if(question){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("question_save_resolution", selectedResolDisplay.Title), MainClass.Languages.Translate("changes_will_be_lost"), Gtk.MessageType.Question,parentWindow);
                int result = md.ShowDialog();

                if (result != (int)Gtk.ResponseType.Yes){
                    isChange = false;
                    return;
                }

            }

            /*TreeSelection ts = tvFiles.Selection;

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

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

            ResolutionDisplay dd=  (ResolutionDisplay)tvFiles.Model.GetValue(ti, 2);
            */
            if (selectedResolDisplay == null ) return;

            selectedResolDisplay.Height=(int)sbHeight.Value;
            selectedResolDisplay.Width=(int)sbWidth.Value;

            selectedResolDisplay.Title = String.IsNullOrEmpty(entTitle.Text)?" ":entTitle.Text;
            selectedResolDisplay.Author=String.IsNullOrEmpty(entAuthor.Text)?" ":entAuthor.Text;
            selectedResolDisplay.Url=String.IsNullOrEmpty(entUrl.Text)?" ":entUrl.Text;
            selectedResolDisplay.Tablet= chbTablet.Active;

            selectedResolDisplay.Save();
            fileListStore.SetValue(selectedTreeIter,2,selectedResolDisplay);
            //fileListStore.SetValue(ti,2,dd);

            isChange = false;
        }
示例#49
0
        private void getObject(string file )
        {
            XmlDocument rssDoc;
            XmlNode nodeRss = new XmlDocument();

            //XmlNode nodeChannel = new XmlDocument();
            XmlNode nodeItem;

            try{
                XmlTextReader reader = new XmlTextReader(file);
             				rssDoc = new XmlDocument();
                rssDoc.Load(reader);
             				for (int i = 0; i < rssDoc.ChildNodes.Count; i++) {
                                if (rssDoc.ChildNodes[i].Name == "doc"){
                        nodeRss = rssDoc.ChildNodes[i];
                    }
                }
                /*for (int i = 0; i < nodeRss.ChildNodes.Count; i++){
                    if (nodeRss.ChildNodes[i].Name == "members"){
                        nodeChannel = nodeRss.ChildNodes[i];
                    }
                }*/
                string parent = "";

                for (int i = 0; i < nodeRss.ChildNodes.Count; i++)
              				{
                    if (nodeRss.ChildNodes[i].Name == "member")
              					{

                        nodeItem = nodeRss.ChildNodes[i];
                        string name="";

                        string signature="";
                        string summary = GetSummary(nodeItem);
                        bool visibility = false;

                        foreach (XmlAttribute atrb  in nodeItem.Attributes){

                            if (atrb.Name == "name"){
                                name =atrb.InnerText;
                            }

                            if (atrb.Name == "signature"){
                                signature =atrb.InnerText;
                            }

                            if (atrb.Name == "visibility"){
                                if (atrb.InnerText.Trim() == "private"){
                                    visibility = true;
                                }
                            }
                        }
                        if(visibility) continue;

                        if(!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(signature)){

                            if(signature.Trim().StartsWith("(") ||
                                signature.Trim().StartsWith("{") ||
                                signature.Trim().StartsWith("[") ||
                                signature.Trim().StartsWith("!")){

                                continue;
                            }

                            if(name.StartsWith("T:")){
                                parent =signature;
                                insertNewRow(signature,signature,(int)CompletionDataTyp.types,"",summary,"");

                            }

                            if(name.Contains("this"))
                                continue;

                            if (name.StartsWith("P:")){
                                int indx = signature.Trim().IndexOf(".");
                                if(indx>0){
                                    string tmp = signature.Substring(0,indx);

                                    if(tmp.Length<2)
                                        continue;

                                    insertNewRow(tmp,signature,(int)CompletionDataTyp.properties,parent,summary,"");
                                    //listMemberSignature.Add(tmp);
                                    continue;
                                }
                                if(signature.Length<2)
                                        continue;

                                insertNewRow(signature,signature,(int)CompletionDataTyp.properties,parent,summary,"");

                            } else if(name.StartsWith("M:")){
                                int indx = signature.IndexOf("(");
                                if(indx>0){
                                    string tmp = signature.Substring(0,indx);

                                    if(tmp.Length<2)
                                        continue;

                                    insertNewRow(tmp,signature,(int)CompletionDataTyp.members,parent,summary,"");
                                    continue;
                                }
                                if(signature.Length<2)
                                        continue;
                                insertNewRow(signature,signature,(int)CompletionDataTyp.members,parent,summary,"");

                            } else if(name.StartsWith("E:")){
                                int indx = signature.IndexOf("(");
                                if(indx>0){
                                    string tmp = signature.Substring(0,indx);

                                    insertNewRow(tmp,signature,(int)CompletionDataTyp.events,parent,summary,"");

                                    continue;
                                }
                                insertNewRow(signature,signature,(int)CompletionDataTyp.events,parent,summary,"");
                            }

                        }

                    }
                }
            } catch(Exception ex){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "ERROR", ex.Message, Gtk.MessageType.Error);
                    md.ShowDialog();
                Console.WriteLine(file);
                Console.WriteLine(ex.Message);
            }
        }
示例#50
0
        private bool LogginAndVerification()
        {
            LoggUser vc = new LoggUser();

            if((MainClass.User == null)||(string.IsNullOrEmpty(MainClass.User.Token))){

                LoginRegisterDialog ld = new LoginRegisterDialog(this);
                int res = ld.Run();

                if (res == (int)Gtk.ResponseType.Cancel){
                    ld.Destroy();
                    return false;
                }
                ld.Destroy();
            }

            if(!vc.Ping(MainClass.User.Token)){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("invalid_login_f1"), "", Gtk.MessageType.Error,this);
                md.ShowDialog();

                LoginRegisterDialog ld = new LoginRegisterDialog(this);
                int res = ld.Run();
                if (res == (int)Gtk.ResponseType.Cancel){
                    ld.Destroy();
                    return false;
                }else if(res == (int)Gtk.ResponseType.Ok){
                    ld.Destroy();
                    return true;
                }
            }
            return true;
        }
示例#51
0
        void OnAddFileClicked(object sender, EventArgs a)
        {
            TreeIter tiDirectory = new TreeIter();
            string pathDir = GetDirectory(ref tiDirectory);

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

            string fileName = "";
            string content ="";

            NewFileDialog nfd = new NewFileDialog();

            int result = nfd.Run();
            if (result == (int)ResponseType.Ok) {
                fileName = nfd.FileName;
                content = nfd.Content;
            }
            nfd.Destroy();
            if (String.IsNullOrEmpty(fileName) ) return;

            string newFile = System.IO.Path.Combine(pathDir, fileName);

            try {
                FileUtility.CreateFile(newFile,content);
            } catch {
                MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_creating_file"), fileName, Gtk.MessageType.Error);
                md.ShowDialog();
            }
            RefreshDir(pathDir, tiDirectory);
            /*if(MainClass.Workspace != null && !String.IsNullOrEmpty(MainClass.Workspace.FilePath)){
                LoadLibs(MainClass.Workspace.RootDirectory);
            };*/
        }
示例#52
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();
        }
示例#53
0
        protected virtual void OnBtnRemoveClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFiles.Selection;

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

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

            EmulatorDisplay dd = (EmulatorDisplay)tvFiles.Model.GetValue(ti, 2);

            MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("question_delete_file", dd.FilePath), "", Gtk.MessageType.Question,parentWindow);
            int result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
                return;

            if (!System.IO.File.Exists(dd.FilePath ))
                return;

            try {
                //fileListStore
                fileListStore.SetValue(ti,2,null);
                fileListStore.Remove(ref ti);
                System.IO.File.Delete(dd.FilePath);
            } catch {
                return;
            }
        }
示例#54
0
        protected virtual void OnBtnDeleteFilterClicked(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;

            MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_filter", cd.Display), "", Gtk.MessageType.Question,parentWindow);
            int result = md.ShowDialog();
            if (result != (int)Gtk.ResponseType.Yes)
                return;

            conditions.Remove(cd);
            maskStore.Clear();
            filterStore.Remove(ref ti);
        }
示例#55
0
 private bool CheckSelectTable()
 {
     if (String.IsNullOrEmpty(curentTable)){
         MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("please_select_table"), "", MessageType.Error,null);
         ms.ShowDialog();
         return false;
     }
     return true;
 }
示例#56
0
        protected virtual void OnBtnDeleteMaskClicked(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);

            if (String.IsNullOrEmpty(rl)) return;

            MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_mask", rl), "", Gtk.MessageType.Question,parentWindow);
            int result = md.ShowDialog();
            if (result != (int)Gtk.ResponseType.Yes)
                return;
            maskStore.Remove(ref tiR);

            LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());
            cd2.Mask.Remove(rl);
            filterStore.SetValues(ti,cd2.Display,cd2);
        }
示例#57
0
        private void GetTableStructure(string table_name)
        {
            tableModel.Clear();
            SqliteConnection conn = (SqliteConnection)sqlLiteDal.GetConnect();
                SqliteDataReader dr = null;
            try {

                        //conn.Open();
                        using (SqliteCommand cmd = conn.CreateCommand())
                        {
                            cmd.CommandText = String.Format("PRAGMA table_info( '{0}' );", table_name);
                            dr = cmd.ExecuteReader();
                        }

                if (dr.HasRows)
                        {
                            //int fieldcount = dr.FieldCount;
                            while (dr.Read())
                            {
                                int cid = Convert.ToInt32(dr[0]);
                    string name = dr[1].ToString();
                    string type = dr[2].ToString();
                    bool notnull = Convert.ToBoolean(dr[3]);
                    string dfltValue = dr[4].ToString();
                    bool pk = Convert.ToBoolean(dr[5]);
                    tableModel.AppendValues(cid, name, type, notnull.ToString(), dfltValue, pk.ToString());

                            }
                        }

            } catch (Exception ex) {
                MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error,null);
                ms.ShowDialog();

            } finally {
                if (dr != null) dr.Close();
                dr = null;
                conn.Close();
                conn = null;
            }
        }
示例#58
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();
        }
示例#59
0
        protected void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            string message = "";
            if(String.IsNullOrEmpty(entrName.Text)){
                message = MainClass.Languages.Translate("new_resolution_error_f1");
            }

            if(String.IsNullOrEmpty(entrSpecific.Text)){
                message = MainClass.Languages.Translate("new_resolution_error_f2");
            }

            if((sbWidth.Value<1)|| (sbHeight.Value<1) ){
                message = MainClass.Languages.Translate("new_resolution_error_f3");
            }

            if(!String.IsNullOrEmpty(message)){
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, message, "", Gtk.MessageType.Error);
                md.ShowDialog();
                return;
            }
            resolution.Name=entrName.Text;
            resolution.Specific=entrSpecific.Text;
            resolution.Width=(int)sbWidth.Value;
            resolution.Height=(int)sbHeight.Value;

            this.Respond(ResponseType.Ok);
        }
示例#60
0
        protected override void OnActivated()
        {
            MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.OkCancel, "Are you sure?", "", Gtk.MessageType.Question);
            int result = md.ShowDialog();
            if(result != (int)Gtk.ResponseType.Ok){
                return;
            }

            ProgressDialog progressDialog;

            string filename = System.IO.Path.Combine(MainClass.Paths.ConfingDir, "completedcache");
            sqlLiteDal = new SqlLiteDal(filename);

            string sql = "";

            if(sqlLiteDal.CheckExistTable("completed") ){
                sql = "DROP TABLE completed ;";
                sqlLiteDal.RunSqlScalar(sql);
            }

            sql = "CREATE TABLE completed (id INTEGER PRIMARY KEY, name TEXT, signature TEXT, type NUMERIC, parent TEXT,summary TEXT ,returnType TEXT ) ;";
            sqlLiteDal.RunSqlScalar(sql);

            SyntaxMode mode = new SyntaxMode();
            mode = SyntaxModeService.GetSyntaxMode("text/moscrif");

            progressDialog = new ProgressDialog("Generated...",ProgressDialog.CancelButtonType.None, mode.Keywords.Count() ,MainClass.MainWindow);

            foreach (Keywords kw in mode.Keywords){

                progressDialog.Update(kw.ToString());
                foreach (string wrd in kw.Words){
                        insertNewRow(wrd,wrd,(int)CompletionDataTyp.keywords,"","","");
                    }
            }

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("data.json", null, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
            fc.TransientFor = MainClass.MainWindow;
            fc.SetCurrentFolder(@"d:\Work\docs-api\output\");

            if (fc.Run() != (int)ResponseType.Accept) {
                return;
            }
            string json ;
            string fileName = fc.Filename;
            progressDialog.Destroy();
            fc.Destroy();
            progressDialog = new ProgressDialog("Generated...",ProgressDialog.CancelButtonType.None,100 ,MainClass.MainWindow);

            using (StreamReader file = new StreamReader(fileName)) {
                json = file.ReadToEnd();
                file.Close();
                file.Dispose();
            }

            //XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(json);
            //doc.Save(fileName+"xml");

            /*JObject jDoc= JObject.Parse(json);
            //classes
            Console.WriteLine("o.Count->"+jDoc.Count);

            foreach (JProperty jp in jDoc.Properties()){
                Console.WriteLine(jp.Name);
            }
            Console.WriteLine("------------");
            JObject classes = (JObject)jDoc["classes"];
            foreach (JProperty jp in classes.Properties()){
                Console.WriteLine(jp.Name);
                JObject classDefin = (JObject)classes[jp.Name];
                string name = (string)classDefin["name"];
                string shortname = (string)classDefin["shortname"];
                string description = (string)classDefin["description"];
                //string type = (string)classDefin["type"];
                insertNewRow(name,name,(int)CompletionDataTyp.types,"",description,name);
            }
            Console.WriteLine("------------");

            JArray classitems = (JArray)jDoc["classitems"];
            foreach (JObject classitem in classitems){

                string name = (string)classitem["name"];
                Console.WriteLine(name);

                string description = (string)classitem["description"];
                string itemtype = (string)classitem["itemtype"];
                string classParent = (string)classitem["class"];
                string signature = (string)classitem["name"];
                CompletionDataTyp type = CompletionDataTyp.noting;
                string returnType= classParent;

                switch (itemtype){
                    case "method":{
                        JArray paramsArray = (JArray)classitem["params"];
                        signature = signature+ GetParams(paramsArray);
                        type = CompletionDataTyp.members;
                        JObject returnJO =(JObject)classitem["return"] ;
                        if(returnJO!=null){
                            returnType = (string)returnJO["type"];
                        }

                        break;
                    }
                    case "property":{

                        string tmpType = (string)classitem["type"];
                        if(!String.IsNullOrEmpty(tmpType)){
                            returnType=tmpType.Replace("{","").Replace("}","");
                        }
                        type = CompletionDataTyp.properties;
                        break;
                    }
                    case "event":{
                        JArray paramsArray = (JArray)classitem["params"];
                        signature = signature+ GetParams(paramsArray);
                        type = CompletionDataTyp.events;
                        break;
                    }
                    case "attribute":{
                        continue;
                        break;
                    }
                    default:{
                        type = CompletionDataTyp.noting;
                        break;
                    }

                }

                insertNewRow(name,signature,(int)type,classParent,description,returnType);
            }*/
            //classitems

            //			string name = (string)o["project"]["name"];
            //			Console.WriteLine(name);

            progressDialog.Destroy();

            md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Done", "", Gtk.MessageType.Info);
            md.ShowDialog();

            return;
            /*

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Select DOC Directory (with xml)", null, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
            FileInfo[] xmls = new FileInfo[]{};

            if (fc.Run() == (int)ResponseType.Accept) {

                DirectoryInfo di = new DirectoryInfo(fc.Filename);
                xmls = di.GetFiles("*.xml");
                //List<string> output = new List<string>();

                //MainClass.CompletedCache.ListTypes= listSignature.Distinct().ToList();
                //MainClass.CompletedCache.ListMembers= listMemberSignature.Distinct().ToList();
            }
            progressDialog.Destroy();
            fc.Destroy();
            progressDialog = new ProgressDialog("Generated...",ProgressDialog.CancelButtonType.None,xmls.Length ,MainClass.MainWindow);
                    foreach (FileInfo xml in xmls)
                    {
                        try
                        {
                    progressDialog.Update(xml.Name);
                    if(!xml.Name.StartsWith("_"))
                        getObject(xml.FullName);
                        }
                        catch(Exception ex) {
                            Console.WriteLine(ex.Message);
                            Console.WriteLine(ex.StackTrace);
                            return;
                        }
                    }
            progressDialog.Destroy();

            md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Done", "", Gtk.MessageType.Info);
            md.ShowDialog();*/
        }