Пример #1
0
        /*
         *
         *
         * A FAZER:
         * -Campo de pesquisa que diminui valores da lista
         * -Pesquisar e apresentar
         *
         */

        public ListaDiagnosticos()
        {
            InitializeComponent();
            servico = new ServicePATA.Service1Client();

            // Define the border style of the form to a dialog box.
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            // Set the MaximizeBox to false to remove the maximize box.
            this.MaximizeBox = false;
            // Set the MinimizeBox to false to remove the minimize box.
            this.MinimizeBox = false;
            // Set the start position of the form to the center of the screen.
            this.StartPosition = FormStartPosition.CenterScreen;
            // Set the Size of the form to Auto Size
            this.AutoSize = true;
            dataGridView1.AllowUserToAddRows = false;


            foreach (SintomaWEB s in servico.lerSintomasXML(PATA.Properties.Settings.Default.token).ToList())
            {
                listBox1.Items.Add(s.nome.ToString());
            }


            if (PATA.Properties.Settings.Default.xmlPath.Equals("-1"))
            {
                OpenFileDialog FD = new OpenFileDialog();
                FD.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
                FD.Title            = "Onde está o ficheiro XML?";

                FD.Filter = "XML files (*.xml)|*.xml";

                if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string fileToOpen = FD.FileName;
                    PATA.Properties.Settings.Default.xmlPath = FD.FileName;
                    PATA.Properties.Settings.Default.Save();
                    xmlPath = PATA.Properties.Settings.Default.xmlPath;
                }


                //foreach (String s in XmlHandler.XmlOperations.listaSintomas(xmlPath))
                //{
                //    listBox1.Items.Add(s.ToString());
                //}
            }
            else
            {
                if (PATA.Properties.Settings.Default.xmlPath == "-1")
                {
                    OpenFileDialog FD = new OpenFileDialog();
                    FD.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
                    FD.Title            = "Onde está o ficheiro XML?";

                    FD.Filter = "XML files (*.xml)|*.xml";

                    if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string fileToOpen = FD.FileName;
                        PATA.Properties.Settings.Default.xmlPath = FD.FileName;

                        PATA.Properties.Settings.Default.Save();
                        xmlPath = PATA.Properties.Settings.Default.xmlPath;
                    }
                }

                xmlPath = PATA.Properties.Settings.Default.xmlPath;


                //foreach (String s in )
                //{
                //  listBox1.Items.Add(s.ToString());
                // }
            }
        }