示例#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
            {
                try
                {
                    List <MyPhotos.Model.FileData> fileDatas = DbService.GetFileDatasByFileId(this.FileActive.FileId);
                    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 (this.FileActive.FileDatas != null)
                    {
                        foreach (MyPhotos.Model.FileData fd in this.FileActive.FileDatas)
                        {
                            ListViewItem item = new ListViewItem(fd.Data.Label);
                            item.SubItems.Add(fd.Value);
                            this.properties.Items.Add(item);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
示例#2
0
 private void DataService_Load()
 {
     this.File           = DbService.GetFileById(this.FileId);
     this.File.FileDatas = DbService.GetFileDatasByFileId(this.FileId);
     this.Datas          = DbService.GetDatas();
 }