Ejemplo n.º 1
0
        public void DisplayService_BindPanel()
        {
            this.properties.Items.Clear();

            this.warning.Text = "";

            if (this.FileActive == null)
            {
                Image image = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"../../Asset/nodata_m.png"));
                this.panelPictureBox.Image = image;
            }
            else
            {
                List<FileData> fileDatas = new List<FileData> { };
                try
                {
                    fileDatas = DbService.GetFileDatasByFileId(this.FileActive.FileId).ToList();
                    this.panelPictureBox.Image = new Bitmap(this.FileActive.Path);

                }
                catch(Exception e)
                {
                    Console.WriteLine(e);
                    this.warning.Text = "Warning: File renamed or location has changed.";

                    Image image = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../Asset/nodata_r.png"));
                    this.panelPictureBox.Image = image;
                }

                try
                {
                 

                    if (fileDatas != null && fileDatas.Count > 0)
                    {
                        foreach (FileData fd in fileDatas)
                        {
                            var data = DbService.GetDataById(fd.DataId);
                            ListViewItem item = new ListViewItem(data.Label);
                            item.SubItems.Add(fd.Value);
                            this.properties.Items.Add(item);
                        }
                    }


                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
Ejemplo n.º 2
0
 private void DataService_Load()
 {
     this.File = DbService.GetFileById(this.FileId);
     this.File.FileDatas = DbService.GetFileDatasByFileId(this.FileId);
     this.Datas = DbService.GetDatas().ToList();
 }