Пример #1
0
 public TreeView(TreeHandler[] treeHandler, Dictionary <String, String> attrDef, ClientClass client)
 {
     InitializeComponent();
     this.treeHandler = treeHandler;
     this.attrDef     = attrDef;
     this.client      = client;
 }
Пример #2
0
        public CalcoloSuAlberoWindow(ClientClass client)
        {
            InitializeComponent();
            this.client = client;

            this.isSelected      = false;
            this.albero          = "";
            NomAttrLabel.Content = "";

            this.nodeString = "";
            this.edgeString = "";

            String treeParameters = client.read();

            if (!treeParameters.Equals("Vuoto"))
            {
                /*-4.1- I parametri arrivano nel formato seguente "NomeAlbero#attr1Vertex?tipo:attr2Vertex?tipo#attrEdge?tipo:attrEdge2?tipo$NomeAlbero2#etc*/

                this.treeHandler = fillTreeHandl(treeParameters);
            }
            else
            {
                this.treeHandler = new TreeHandler[0];
            }


            foreach (TreeHandler tree in treeHandler)
            {
                SelAlbCalcomboBox.Items.Add(tree.nome);
            }
        }
Пример #3
0
 public TreeView(TreeHandler[] treeHandler, Dictionary<String, String> attrDef,  ClientClass client)
 {
     InitializeComponent();
     this.treeHandler = treeHandler;
     this.attrDef = attrDef;
     this.client = client;
 }
Пример #4
0
        public EsportaFileWindow(ClientClass client, TreeHandler[] parameters)
        {
            InitializeComponent();
            this.client = client;
            this.trees  = parameters;
            this.file   = "";

            foreach (TreeHandler tree in trees)
            {
                MenuComboBox.Items.Add(tree.nome);
            }
        }
Пример #5
0
        public EsportaFileWindow(ClientClass client, TreeHandler[] parameters)
        {
           
            InitializeComponent();
            this.client = client;
            this.trees = parameters;
            this.file = "";

            foreach (TreeHandler tree in trees)
            {
                MenuComboBox.Items.Add(tree.nome);
            }
        }
Пример #6
0
        public CreaAlberoWindow(TreeHandler[] treeHandler, Dictionary <String, String> attrDef, ClientClass client)
        {
            InitializeComponent();

            this.client         = client;
            this.attrDef        = attrDef;
            this.treeHandler    = treeHandler;
            this.vertexAttrList = new Dictionary <String, String[]>();
            this.edgeAttrList   = new Dictionary <String, String[]>();
            this.type           = "";

            setVisibile(false);
            setDefStringVisibility(false);
            setRandomNumberVisibility(false);
            foreach (KeyValuePair <String, String> attribute in attrDef)
            {
                AttributeListbox.Items.Add(attribute.Key);
            }
        }
Пример #7
0
        public CreaAlberoWindow(TreeHandler[] treeHandler, Dictionary<String, String> attrDef, ClientClass client)
        {
            InitializeComponent();
            
            this.client = client;
            this.attrDef = attrDef;
            this.treeHandler = treeHandler;
            this.vertexAttrList = new Dictionary<String, String[]>();
            this.edgeAttrList = new Dictionary<String, String[]>();
            this.type = "";

            setVisibile(false);
            setDefStringVisibility(false);
            setRandomNumberVisibility(false);
            foreach (KeyValuePair<String, String> attribute in attrDef)
            {
                AttributeListbox.Items.Add(attribute.Key);
            }
        }
Пример #8
0
        public ModificaAlberoWindow(ClientClass client)
        {
            InitializeComponent();
            this.client = client;
            
            this.albero = "";
            this.nomeStartEnd = "";
            this.nodeString = "";
            this.edgeString = "";
            this.NomAttrLabel.Content = "";
            this.isSelected = false;
            this.type = "";

            

            String treeParameters = client.read();

            if (!treeParameters.Equals("Vuoto"))
            {

                /*-4.1- I parametri arrivano nel formato seguente "NomeAlbero#attr1Vertex?tipo:attr2Vertex?tipo#attrEdge?tipo:attrEdge2?tipo$NomeAlbero2#etc*/

                this.treeHandler = fillTreeHandl(treeParameters);
            }
            else
            {
                this.treeHandler = new TreeHandler[0];
            }



            foreach (TreeHandler tree in treeHandler)
            {
                SelAlbModcomboBox.Items.Add(tree.nome);

            }
        }
Пример #9
0
/*_________________Metodo che si connette al server e al db specificati dai parametri___________________________________________*/ 
        private void ConnectButton_Click(object sender, RoutedEventArgs e)
        {
            /*controlla se i parametri sono errati*/
            if (!CheckParameters())
            {
                ParametersErrorWindow error = new ParametersErrorWindow(false, "Parametri errati");
                error.ShowDialog();
            }

            /*Se i parametri sono sintatticamente corretti*/
            else
            {
                /*parsing parametri*/
                IPAddress ip = IPAddress.Parse(IPStartTextBox.Text);
                int porta = Int32.Parse(PortStartTextBox.Text);
            /*______-----1-------Connettersi al Server_________________________*/
                ClientClass clientGui = new ClientClass(ip, porta);
                /*verifica il successo della connessione con il server*/
                if (!clientGui.connect())
                {
                    this.Close();
                    return;
                }
            
            /*______-----2-------Inviare username e password al server_________*/
                String parameters = IpDBTextBox.Text + '$' + UsernameTextBoxStart.Text + '$' + PasswordBoxStart.Password;
                clientGui.write(parameters);
          
            /*______-----3--------Check login database andato a buon fine_______*/
                String checkAuth = clientGui.read();
                /*-3.1- Se l'autenticazione non è andata a buon fine il server ci ritorna "1", altrimenti "0" */
                if (checkAuth.Equals("1"))
                {
                    ParametersErrorWindow errorAuth = new ParametersErrorWindow(false, "Auth DB fallita");
                    errorAuth.ShowDialog();
                    clientGui.disconnect();
                }/*Fine if-autenticazione non andata a buon fine*/
                else
                /*-3.2-Autenticazione andata a buon fine*/
                {
            /*______-----4-------Salvare in una strutturadati i dati dei database ricevuti dal server*/
                    String treeParameters = clientGui.read();
                    TreeHandler[] treeHandler;
                    if (!treeParameters.Equals("Vuoto"))
                    {

                        /*-4.1- I parametri arrivano nel formato seguente "NomeAlbero#attr1Vertex?tipo:attr2Vertex?tipo#attrEdge?tipo:attrEdge2?tipo$NomeAlbero2#etc*/

                        treeHandler = fillTreeHandl(treeParameters);
                    }
                    else
                    {
                        treeHandler = new TreeHandler[0];
                    }
           /*______-----5-------Una volta che il server ci ha inviato la lista degli alberi con gli attributi,viene inviata l'attribute definition */
                    Dictionary<String, String> attrDef = attrDefPars(clientGui.read());
                    
           /*______-----6-------Instanziare finestra TreeView passando al costruttore treeHandler[] e attrDef e client*/
                    TreeView treeView = new TreeView(treeHandler, attrDef, clientGui);
                    treeView.Show();
                    this.Close();
                }/*Fine if-autenticazione andata a buon-fine*/
            }/*Fine if-Se i parametri sono sintatticamente corretti*/
        }/*Fine funzione ConnectButton_Click*/
Пример #10
0
/*_________________Metodo che si connette al server e al db specificati dai parametri___________________________________________*/
        private void ConnectButton_Click(object sender, RoutedEventArgs e)
        {
            /*controlla se i parametri sono errati*/
            if (!CheckParameters())
            {
                ParametersErrorWindow error = new ParametersErrorWindow(false, "Parametri errati");
                error.ShowDialog();
            }

            /*Se i parametri sono sintatticamente corretti*/
            else
            {
                /*parsing parametri*/
                IPAddress ip    = IPAddress.Parse(IPStartTextBox.Text);
                int       porta = Int32.Parse(PortStartTextBox.Text);
                /*______-----1-------Connettersi al Server_________________________*/
                ClientClass clientGui = new ClientClass(ip, porta);
                /*verifica il successo della connessione con il server*/
                if (!clientGui.connect())
                {
                    this.Close();
                    return;
                }

                /*______-----2-------Inviare username e password al server_________*/
                String parameters = IpDBTextBox.Text + '$' + UsernameTextBoxStart.Text + '$' + PasswordBoxStart.Password;
                clientGui.write(parameters);

                /*______-----3--------Check login database andato a buon fine_______*/
                String checkAuth = clientGui.read();
                /*-3.1- Se l'autenticazione non è andata a buon fine il server ci ritorna "1", altrimenti "0" */
                if (checkAuth.Equals("1"))
                {
                    ParametersErrorWindow errorAuth = new ParametersErrorWindow(false, "Auth DB fallita");
                    errorAuth.ShowDialog();
                    clientGui.disconnect();
                }/*Fine if-autenticazione non andata a buon fine*/
                else
                /*-3.2-Autenticazione andata a buon fine*/
                {
                    /*______-----4-------Salvare in una strutturadati i dati dei database ricevuti dal server*/
                    String        treeParameters = clientGui.read();
                    TreeHandler[] treeHandler;
                    if (!treeParameters.Equals("Vuoto"))
                    {
                        /*-4.1- I parametri arrivano nel formato seguente "NomeAlbero#attr1Vertex?tipo:attr2Vertex?tipo#attrEdge?tipo:attrEdge2?tipo$NomeAlbero2#etc*/

                        treeHandler = fillTreeHandl(treeParameters);
                    }
                    else
                    {
                        treeHandler = new TreeHandler[0];
                    }
                    /*______-----5-------Una volta che il server ci ha inviato la lista degli alberi con gli attributi,viene inviata l'attribute definition */
                    Dictionary <String, String> attrDef = attrDefPars(clientGui.read());

                    /*______-----6-------Instanziare finestra TreeView passando al costruttore treeHandler[] e attrDef e client*/
                    TreeView treeView = new TreeView(treeHandler, attrDef, clientGui);
                    treeView.Show();
                    this.Close();
                } /*Fine if-autenticazione andata a buon-fine*/
            }     /*Fine if-Se i parametri sono sintatticamente corretti*/
        }         /*Fine funzione ConnectButton_Click*/
Пример #11
0
 public ImportaFileWindow(ClientClass client)
 {
     InitializeComponent();
     this.client = client;
     
 }
Пример #12
0
 public ImportaFileWindow(ClientClass client)
 {
     InitializeComponent();
     this.client = client;
 }