Ejemplo n.º 1
0
        private void btnAddToList_Click(object sender, EventArgs e)
        {
            bool   ret  = false;
            string name = string.Empty;

            try
            {
                DisplayClient dc = new DisplayClient();
                ret  = dc.Connect(ipbManual.IP);
                name = dc.RequestName();
                if (!ret)
                {
                    throw new Exception("Error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "There was an issue connecting to this DisplayServer.", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ret = AddGridEntry(true, ipbManual.IP, name);
            if (!ret)
            {
                MessageBox.Show(this, "Doh, this Display Server is already added!", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 2
0
        private void btnCreateProjection_Click(object sender, EventArgs e)
        {
            if (grid.RowCount == 0)
            {
                MessageBox.Show(this, "Please add a screen first using 'Add Screen'!", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ProjectionCreator pc = new ProjectionCreator();

            pc.ShowDialog(this);
            ProjectionObj projection = (ProjectionObj)pc.Tag;

            if (projection == null)
            {
                return;
            }
            //Ret: Name,Resolution,IP
            string data = ShowSelector();

            if (data == null)
            {
                return;
            }
            string[] splData = data.Split(',');
            string   ip      = splData[2];

            DisplayClient client = new DisplayClient();

            client.Connect(ip);
            client.SendProjection(projection);
            client.Disconnect();
            client = null;
        }
Ejemplo n.º 3
0
 private void SendImageToIP(string ip, Image img)
 {
     try
     {
         DisplayClient sender = new DisplayClient();
         sender.Connect(IPAddress.Parse(ip));
         ProjectionObj proj = new ProjectionObj(DateTime.Now, DateTime.Now.AddHours(1))
         {
             isDefault = true
         };
         proj.AddSlide(img);
         sender.SendProjection(proj);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Ejemplo n.º 4
0
        //Initializes Client DGV
        private void initializeClientDGV()
        {
            List <DisplayClient> displayClient = new List <DisplayClient>();
            List <Client>        clients       = Controller <BloodBankEntities, Client> .SetBindingList().ToList();

            foreach (Client c in clients)
            {
                //create display object
                DisplayClient dc = new DisplayClient()
                {
                    displayClientId   = c.ClientId.ToString(),
                    displayClientName = c.ClientLastName + ", " + c.ClientFirstName,
                };
                displayClient.Add(dc);
            }
            //add to DGV
            dataGridViewClient.DataSource          = displayClient;
            dataGridViewClient.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Ejemplo n.º 5
0
        private void AddDisplay(string ip)//string name, Image img)
        {
            for (int i = 0; i < grid.RowCount; i++)
            {
                if (grid.Rows[i].Tag.Equals(ip))
                {
                    return;
                }
            }


            int    id         = grid.Rows.Add();
            string name       = "--Offline--";
            string resolution = "--Offline--";

            //Connection Test
            Probe probe       = new Probe();
            bool  isConnected = probe.TestIP(ip, true);

            grid.Rows[id].Tag = ip;
            if (isConnected)
            {
                grid.Rows[id].Cells[0].Value = Projection_Client.Properties.Resources.connected_sm;
                DisplayClient dc = new DisplayClient();
                dc.Connect(ip);
                name       = dc.RequestName();
                resolution = dc.RequestResolution();
                dc.Disconnect();
            }
            else
            {
                grid.Rows[id].Cells[0].Value = Projection_Client.Properties.Resources.disconnected_sm;
            }
            //gridDisplays.Rows[id].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            grid.Rows[id].Cells[1].Value = name;
            grid.Rows[id].Cells[2].Value = resolution;
            //gridDisplays.Rows[id].Tag
            File.AppendAllText("screens.txt", ip + "\n");
        }
Ejemplo n.º 6
0
        private void btnImportSlides_Click(object sender, EventArgs e)
        {
            #if MSO_BUILD
            if (gridDisplays.RowCount == 0)
            {
                MessageBox.Show(this, "Please add a screen first using 'Add Screen'!", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //Ret: Name,WidthxHeight,IP
            string screen = ShowSelector();
            if (screen == null)
            {
                return;
            }
            string[] splData = screen.Split(',');
            int      width   = int.Parse(splData[1].Split('x')[0]);
            int      height  = int.Parse(splData[1].Split('x')[1]);
            string   ip      = splData[2];

            if (screen == null)
            {
                return;
            }

            //string selScreenRes = screen.Substring(screen.IndexOf("[") + 1);
            //selScreenRes = selScreenRes.Substring(0, selScreenRes.Length - 1);
            //int width = int.Parse(selScreenRes.Split('x')[0]);
            //int height = int.Parse(selScreenRes.Split('x')[1]);

            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Power Point|*.pptx|All Files|*.*";
            ofd.ShowDialog();
            if (String.IsNullOrEmpty(ofd.FileName))
            {
                return;
            }
            ApplicationClass pptApp = new ApplicationClass();

            Presentation pres = pptApp.Presentations.Open(ofd.FileName, MsoTriState.msoFalse,
                                                          MsoTriState.msoFalse, MsoTriState.msoFalse);

            List <string> files = new List <string>();
            for (int i = 1; i <= pres.Slides.Count; i++)
            {
                string file = Environment.CurrentDirectory + @"\slide" + i + ".png";
                files.Add(file);
                pres.Slides[i].Export(file, "PNG", width, height);
            }
            ProjectionCreator pc = new ProjectionCreator(files);
            pc.ShowDialog(this);
            if (pc.Tag == null)
            {
                return;
            }
            Projection    proj   = (Projection)pc.Tag;
            DisplayClient client = new DisplayClient();
            client.Connect(ip);
            client.SendProjection(proj);
            client.Disconnect();
            client = null;
            //MessageBox.Show(client.RequestProjectionManager().GetName());
            #endif
        }
Ejemplo n.º 7
0
 public Client GetClient(DisplayClient displayClient)
 {
     return(context.Clients.ToList().Where(i => i.IdClient == displayClient.Client.IdClient).FirstOrDefault());
 }
Ejemplo n.º 8
0
 public ProjectionViewer(DisplayClient client)
 {
     InitializeComponent();
     this.client = client;
 }