Exemplo n.º 1
0
        public string PickExistingFile(PickingData data)
        {
            return(QFileDialog.GetOpenFileName(
                       (Central.Manager.IDE as LinuxIDE),
                       "Select File",
                       Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                       "All Files (*.*)"
                       ));

            /*FileChooserDialog fcd = new FileChooserDialog(
             *  "Select File",
             *  (Central.Manager.IDE as LinuxIDE),
             *  FileChooserAction.Open,
             *  "Cancel", ResponseType.Cancel,
             *  "Open", ResponseType.Accept);
             * fcd.Filter = new FileFilter();
             * string[] f = data.Filter.Split(new char[] { '|' });
             * for (int i = 0; i < f.Length; i += 2)
             *  fcd.Filter.AddPattern(f[i + 1]);
             * string result = null;
             * if (fcd.Run() == (int)ResponseType.Accept)
             *  result = fcd.Filename;
             * fcd.Destroy();
             * return result;*/
        }
Exemplo n.º 2
0
        public void SlotOpen()
        {
            string fileName =
                QFileDialog.GetOpenFileName("","Coverage Files (*.cov)",this,
                                            "","Choose a file","Coverage Files (*.cov)");

            if (fileName != null)
            {
                openFile(fileName);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Open command file
        /// </summary>
        private void OpenCommandFile()
        {
            // New dialog for select command file
            string selectedFile = QFileDialog.GetOpenFileName(this,
                                                              GlobalObj.LMan.GetString("selectfile"),
                                                              null,
                                                              "*.comex");

            if (string.IsNullOrEmpty(selectedFile))
            {
                return;
            }


            // path of a right file returned
            commandFilePath = selectedFile;
            commandFileName = System.IO.Path.GetFileNameWithoutExtension(commandFilePath);
            log.Debug("file selected: " + commandFilePath);

            UpdateGuiForCommandFile();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Open contacts file.
        /// </summary>
        private void OpenContactsFile()
        {
            GlobalObjUI.ContactsFilePath = "";

            // New dialog for select contacts file
            string selectedFile = QFileDialog.GetOpenFileName(this,
                                                              GlobalObjUI.LMan.GetString("openfileact"),
                                                              null,
                                                              "monosim files *.monosim (*.monosim)");

            if (string.IsNullOrEmpty(selectedFile))
            {
                return;
            }

            // path of a right file returned
            GlobalObjUI.ContactsFilePath = selectedFile;

            // Update gui
            UpdateFileControls(false);

            // Clear ListView
            mainwindow_Ui.LstFileContacts.Clear();
            MainClass.QtWait();

            try
            {
                GlobalObjUI.FileContacts = new Contacts();
                StreamReader sr       = new StreamReader(GlobalObjUI.ContactsFilePath);
                string       descRow  = sr.ReadLine();
                string       phoneRow = "";
                while (!sr.EndOfStream)
                {
                    phoneRow = sr.ReadLine();
                    // check for right values
                    if (descRow.Trim() != "" && phoneRow.Trim() != "")
                    {
                        GlobalObjUI.FileContacts.SimContacts.Add(new Contact(descRow, phoneRow));
                    }

                    // read new contact description
                    descRow = sr.ReadLine();
                }
                sr.Close();
                sr.Dispose();
                sr = null;
            }
            catch (Exception Ex)
            {
                log.Error("MainWindowClass::OpenContactsFile: " + Ex.Message + "\r\n" + Ex.StackTrace);
                MainClass.ShowMessage(this, "ERROR", Ex.Message, MainClass.MessageType.Error);
                return;
            }

            // loop to append data readed from file
            List <string> rowContent = null;

            foreach (Contact cnt in GlobalObjUI.FileContacts.SimContacts)
            {
                rowContent = new List <string>();
                rowContent.Add(" ");
                rowContent.Add(cnt.Description);
                rowContent.Add(cnt.PhoneNumber);
                new QTreeWidgetItem(mainwindow_Ui.LstFileContacts, rowContent);
            }

            UpdateFileControls(true);
        }