コード例 #1
0
        private void pictureDatadisk_Click(object sender, EventArgs e)
        {
            PictureBoxDT picture = (PictureBoxDT)sender;

            AppData.selectedDatadisk = AppData.Database.FirstOrDefault(d => d.datadiskName == picture.data);
            fillServerToLayout(picture.data);
            serverButtonsLogic();
        }
コード例 #2
0
        private void pictureServer_Click(object sender, EventArgs e)
        {
            PictureBoxDT picture = (PictureBoxDT)sender;

            AppData.selectedServer = AppData.selectedDatadisk.servers.FirstOrDefault(s => s.ServerName == picture.data);
            Form1 f = new Form1();

            f.Show();
            fillServerToLayout(AppData.selectedDatadisk.datadiskName);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="data"></param>
        /// <param name="adress">Adress==null -> default icon from pc</param>
        /// <returns></returns>
        public static PictureBoxDT CreatePicture(int width, int height, string data, string adress = null)
        {
            RLMS_NEW.Components.PictureBoxDT picture = new PictureBoxDT()
            {
                Width = width, Height = height, SizeMode = PictureBoxSizeMode.StretchImage
            };

            picture.data   = data;
            picture.Cursor = Cursors.Hand;


            if (adress != null)
            {
                //stahnuti ikony ze serveru

                try
                {
                    string[] hostParts = new System.Uri(adress).Host.Split('.');
                    string   domain    = String.Join(".", hostParts.Skip(Math.Max(0, hostParts.Length - 2)).Take(2));
                    //PictureBoxDT img = new PictureBoxDT();
                    Uri favicon = new Uri("http://www.google.com/s2/favicons?domain=" + domain, UriKind.Absolute);
                    adress = favicon.ToString();
                    picture.Load(adress);
                }
                catch
                {
                    // adress = "./icons/error.png";
                    picture.ImageLocation = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "/icons/error.png";
                }

                //  picture.Load(adress);
            }
            else
            {
                if (File.Exists(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "/icons/" + data + ".png"))
                {
                    picture.ImageLocation = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "/icons/" + data + ".png";
                }
                else
                {
                    picture.ImageLocation = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "/icons/error.png";
                }
            }
            //Vytvořeni obrazku


            return(picture);
        }
コード例 #4
0
        //Zobrazení serveru
        private void fillServerToLayout(string datadisk)
        {
            serverButtonsLogic();
            ServersflowLayoutPanel1.Controls.Clear();
            label1.Text = AppData.selectedDatadisk.datadiskName;


            //select servers by datadisk
            List <Server> servers = null;

            foreach (Datadisk d in AppData.Database)
            {
                if (d.datadiskName == datadisk)
                {
                    servers = d.servers;
                }
            }

            foreach (Server s in servers)
            {
                //vytvorim tabulku 1x2
                TableLayoutPanel Table = new TableLayoutPanel();
                Table = HomeScreen_Logic.CreateTable(1, 2);

                //Vytvorim si novy label a vlozim dotabulky
                Label l = new Label();
                l             = HomeScreen_Logic.CreateLabel(s.ServerName, 150, 40);
                l.TextAlign   = ContentAlignment.TopLeft;
                l.MouseClick += new MouseEventHandler(this.labelServer_Click);
                Table.Controls.Add(l, 1, 0);


                //vytvorim obrazek + nastavim jeho vlastnosti
                RLMS_NEW.Components.PictureBoxDT picture = new PictureBoxDT()
                {
                    Width = 16, Height = 16, SizeMode = PictureBoxSizeMode.StretchImage
                };
                picture             = HomeScreen_Logic.CreatePicture(16, 16, s.ServerName, s.Website);
                picture.MouseClick += new MouseEventHandler(this.pictureServer_Click); //po kliknuti na obrazek posle objekt metode p_Click
                Table.Controls.Add(picture, 0, 0);                                     //co chci pridat ,sloupec,radek

                ServersflowLayoutPanel1.Controls.Add(Table);                           //pridám tabulku do panelu
            }
        }
コード例 #5
0
        private void fillDatadisk()
        {
            DTflowLayoutContendWidth = 0;
            DataDiskflowLayoutPanel1.Controls.Clear();

            pictureBox_AddServer.Location = new Point(10, 10);

            int width  = 150;
            int height = 200;

            // DataDiskflowLayoutPanel1.Height = 100;

            //Zobrazení datadisku
            foreach (Datadisk d in AppData.Database)
            {
                //vytvorim tabulku 1x2
                TableLayoutPanel Table = new TableLayoutPanel();
                Table = HomeScreen_Logic.CreateTable(2, 1);


                //Vytvorim si novy label a vlozim dotabulky
                Label l = new Label();
                l = HomeScreen_Logic.CreateLabel(d.datadiskName, width, 70);
                Table.Controls.Add(l, 0, 1);

                //vytvorim obrazek + nastavim jeho vlastnosti
                RLMS_NEW.Components.PictureBoxDT picture = new PictureBoxDT();
                picture = HomeScreen_Logic.CreatePicture(width, height, d.datadiskName);

                picture.MouseClick += new MouseEventHandler(this.pictureDatadisk_Click); //po kliknuti na obrazek posle objekt metode p_Click
                picture.MouseEnter += new EventHandler(this.pictureDatadisk_MouseEnter);
                picture.MouseLeave += new EventHandler(this.pictureDatadisk_MouseLeave);

                DTflowLayoutContendWidth      += width + 15;
                DataDiskflowLayoutPanel1.Width = DTflowLayoutContendWidth;

                Table.Controls.Add(picture, 0, 0);            //co chci pridat ,sloupec,radek
                DataDiskflowLayoutPanel1.Controls.Add(Table); //pridám tabulku do panelu
                Home_screen_Resize(null, null);
            }
        }
コード例 #6
0
        private void pictureDatadisk_MouseLeave(object sender, EventArgs e)
        {
            PictureBoxDT picture = (PictureBoxDT)sender;

            picture.BackColor = SystemColors.Control;
        }