public bool ScreenExists(ScreenShot screen)
 {
     var group = screenGroups.FirstOrDefault(g => g.Name.Equals(screen.Group));
     if (group != null)
     {
         foreach (ScreenShot s in group.ScreenShots)
         {
             if (s.Path == screen.Path) return true;
         }
     }
     return false;
 }
 public bool ScreenNodeExists(ScreenShot screen)
 {
     return false;
 }
 public void AddScreen(ScreenShot s)
 {
 }
Beispiel #4
0
        /// <summary>
        /// Add a main node for the screen shot group
        /// </summary>
        /// <param name="group">Name of screen shot group</param>
        private void AddMainNode(string group)
        {
            ScreenShot s = new ScreenShot();

            TreeNode mainNode = new TreeNode();
            mainNode.Name = group;
            mainNode.Text = s.FormatGroup(group);
            mainNode.Tag = group;
            this.treeViewScreens.Nodes.Add(mainNode);
        }
Beispiel #5
0
        /// <summary>
        /// Add a picture to the panel
        /// </summary>
        /// <param name="path">File path</param>
        private void AddPictureToPanel(string path)
        {
            ScreenShot s = new ScreenShot(path);

            PictureBox pb = new PictureBox();
            pb.Width = 160;
            pb.Height = 100;
            pb.Name = path;
            pb.Tag = (string)path;
            pb.MouseClick += pb_MouseClick;

            ToolTip tt = new ToolTip();
            tt.SetToolTip(pb, s.ComputerName);

            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            pb.SizeMode = PictureBoxSizeMode.Zoom;
            pb.Image = Image.FromStream(fs);
            fs.Close();

            flowLayoutPanelScreens.Controls.Add(pb);
        }
Beispiel #6
0
 /// <summary>
 /// Add a file to the tree
 /// </summary>
 /// <param name="path">File path</param>
 private void AddFile(string path)
 {
     ScreenShot s = new ScreenShot(path);
     if (!MainNodeExists(s.Group))
     {
         AddMainNode(s.Group);
     }
     if (!ChildNodeExists(s.ComputerName, s.Group))
     {
         AddChildNode(s.ComputerName, s.Group, path);
     }
 }
Beispiel #7
0
 /// <summary>
 /// Fires after selection of a tree node, displays the screen shot file accordingly
 /// </summary>
 private void treeViewScreens_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (treeViewScreens.SelectedNode.Level == 0)
     {
         //toolStripStatusLabel1.Text = s.FileName;
         ShowPictureList(treeViewScreens.SelectedNode.Tag.ToString());
     }
     if (treeViewScreens.SelectedNode.Level == 1)
     {
         ScreenShot s = new ScreenShot(treeViewScreens.SelectedNode.Tag.ToString());
         toolStripStatusLabel1.Text = s.FileName;
         ShowPicture(s.Path);
     }
 }
Beispiel #8
0
 /// <summary>
 /// Shows a picture in zoom mode
 /// </summary>
 /// <param name="path">File path</param>
 private void ShowPicture(string path)
 {
     ScreenShot s = new ScreenShot(path);
     panelScreens.Visible = false;
     flowLayoutPanelScreens.Visible = false;
     panelScreens.Controls.Clear();
     PictureBoxEx pb = new PictureBoxEx();
     pb.Name = "pictureBoxEx";
     pb.Dock = DockStyle.Fill;
     pb.Picture = s.Path;
     ToolTip tt = new ToolTip();
     tt.SetToolTip(pb, s.ComputerName);
     panelScreens.Controls.Add(pb);
     panelScreens.Visible = true;
 }
Beispiel #9
0
 /// <summary>
 /// Select a treeview node by path
 /// </summary>
 /// <param name="path">Path of the screenshot file</param>
 private void SelectNode(string path)
 {
     ScreenShot s = new ScreenShot(path);
     TreeNodeCollection groups = treeViewScreens.Nodes;
     treeViewScreens.CollapseAll();
     foreach (TreeNode n in groups)
     {
         if (n.Name == s.Group)
         {
             n.Expand();
             TreeNodeCollection computers = n.Nodes;
             foreach (TreeNode c in computers)
             {
                 if (c.Name == s.ComputerName)
                 {
                     treeViewScreens.SelectedNode = c;
                     break;
                 }
             }
             break;
         }
     }
 }
Beispiel #10
0
 /// <summary>
 /// Remove a file from the tree
 /// </summary>
 /// <param name="path"></param>
 private void RemoveFile(string path)
 {
     ScreenShot s = new ScreenShot(path);
     try
     {
         RemoveChildNode(s.ComputerName, s.Group);
         if (treeViewScreens.Nodes[s.Group].Nodes.Count == 0)
         {
             RemoveMainNode(s.Group);
         }
     }
     catch
     {
         // Swallow this
     }
 }