コード例 #1
0
        public Settings(IntPtr Connection, Share callingForm, Credenziali cred)
        {
            InitializeComponent();
            //prelevare e inizializzare il valore di Visible dal file credenziali
            s           = callingForm;           connessione = Connection;
            credentials = cred;
            if (cred.get_visibility() == "true")
            {
                visible = true;
            }
            else
            {
                visible = false;
            }
            if (cred.get_accettaAutomaticamente() == "true")
            {
                accettaAutomaticamente = true;
            }
            else
            {
                accettaAutomaticamente = false;
            }


            set_private(visible);
            set_accettaAutomaticamente(accettaAutomaticamente);
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: durantieu/FileSharingLAN
        public void fill_credentials()
        {
            string temp;

            string[]     temp2;
            StreamReader sr = new StreamReader(home_dir + "Credenziali.txt");

            while ((temp = sr.ReadLine()) != null)
            {
                temp2 = temp.Split('|');
                if (temp2[0] == "Nome")
                {
                    nome = temp2[1];
                }
                if (temp2[0] == "Cognome")
                {
                    cognome = temp2[1];
                }
                if (temp2[0] == "Path_immagine_profilo")
                {
                    path_imm_profilo = temp2[1];
                }
                if (temp2[0] == "Path_file_transfer")
                {
                    path_file_trans = temp2[1];
                }
                if (temp2[0] == "accettaAutomaticamente")
                {
                    if (temp2[1] == "true")
                    {
                        accettaAutomaticamente = true;
                    }
                    else
                    {
                        accettaAutomaticamente = false;
                    }
                }
                if (temp2[0] == "Visible")
                {
                    if (temp2[1] == "true")
                    {
                        visibility = true;
                    }
                    else
                    {
                        visibility = false;
                    }
                }
            }
            sr.Close();
            cred = new Credenziali(nome, cognome, path_imm_profilo, path_file_trans, accettaAutomaticamente, visibility);
        }
コード例 #3
0
ファイル: Share.cs プロジェクト: durantieu/FileSharingLAN
        public void update_credentials(Settings form)
        {
            log.fill_credentials();
            cred              = log.get_credentials();
            label4.Text       = cred.get_nome();
            label5.Text       = cred.get_cognome();
            pictureBox2.Image = System.Drawing.Image.FromFile(cred.get_immagine_profilo());

            pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox2.Refresh();
            pictureBox2.Update();

            form.Close();
        }
コード例 #4
0
ファイル: Login.cs プロジェクト: durantieu/FileSharingLAN
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "")
            {
                nome             = textBox1.Text;
                cognome          = textBox2.Text;
                path_file_trans  = textBox3.Text;
                path_imm_profilo = textBox4.Text;
                visibility       = !checkBox1.Checked;

                cred = new Credenziali(nome, cognome, path_imm_profilo, path_file_trans, accettaAutomaticamente, visibility);

                Share f1 = new Share(this, false, "");
                f1.Show();
                this.Hide();
            }
        }
コード例 #5
0
ファイル: Share.cs プロジェクト: durantieu/FileSharingLAN
        public Share(Login l, bool nascosto, string path)
        {
            hidden = nascosto;
            StringBuilder strBuilder = new StringBuilder();

            firstGetHomeDir(strBuilder);
            homeDir = strBuilder.ToString();
            closing = false;
            InitializeComponent();
            log         = l;
            cred        = l.get_credentials();
            connessione = creaConnessione(cred.ToString());
            label4.Text = cred.get_nome();
            label5.Text = cred.get_cognome();
            pictureBox2.ImageLocation = cred.get_immagine_profilo();

            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pictureBox2.Width - 3, pictureBox2.Height - 3);
            Region rg = new Region(gp);

            pictureBox2.Region = rg;

            mainPipe = new NamedPipeClientStream(@"mainPipe");

            p = new PollingPipe(null, null, null, null, mainPipe, this, null, 1, true);


            //-------------------- BackgroundMode code
            this.menuItem1 = new System.Windows.Forms.MenuItem();
            this.menuItem2 = new System.Windows.Forms.MenuItem();

            this.components1 = new System.ComponentModel.Container();

            this.contextMenu1 = new System.Windows.Forms.ContextMenu();

            this.contextMenu1.MenuItems.AddRange(
                new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem2 });



            this.menuItem1.Index  = 0;
            this.menuItem1.Text   = "Exit";
            this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);

            this.menuItem2.Index  = 1;
            this.menuItem2.Text   = "Modalità Privata";
            this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);

            if (cred.get_visibility() == "false")
            {
                menuItem2.Checked = true;
            }
            else
            {
                menuItem2.Checked = false;
            }


            notifyIcon1.ContextMenu = this.contextMenu1;

            if (nascosto)
            {
                Opacity       = 0;
                ShowInTaskbar = false;

                sf = new SendFiles(path, connessione, path, this, true);
                sf.Show();
            }
        }