private void ReportAlbumPictures(PictureAlbum pa, int iPic) { string sIndiciesToItem = ""; string sFolderPath = ""; foreach (StackItem si in m_stck) { if (sIndiciesToItem.Length > 0) { sIndiciesToItem += "|"; } sIndiciesToItem += si.Index.ToString(); if (sFolderPath.Length > 0) { sFolderPath += "\\"; } sFolderPath += si.pa.Name; } /* * if( sIndiciesToItem.Length > 0 ) sIndiciesToItem += "|"; * sIndiciesToItem += m_iIdx.ToString(); */ if (sIndiciesToItem.Length > 0) { sIndiciesToItem += "|"; } sIndiciesToItem += iPic.ToString(); if (sFolderPath.Length > 0) { sFolderPath += "\\"; } sFolderPath += pa.Name; Picture pic = pa.Pictures[iPic]; RscMediaLibItemDesc it = new RscMediaLibItemDesc(); it.bFolder = false; it.sIndiciesToItem = sIndiciesToItem; it.sFolderPath = sFolderPath; it.sName = pic.Name; it.sDetails = ""; it.sDetails += sFolderPath; it.sDetails += "\r\n"; it.sDetails += sIndiciesToItem; it.sDetails += "\r\n"; it.sDetails += "DateTime: " + pic.Date.ToShortDateString() + " " + pic.Date.ToShortTimeString(); it.sDetails += "\r\n"; it.sDetails += "Dimenstion: " + pic.Width.ToString() + " x " + pic.Height.ToString(); AddFile(it); }
/* * private void btn_DoubleTap(object sender, System.Windows.Input.GestureEventArgs e) * { * Button btn; * btn = ((Button) sender); * RscMediaLibItemDesc it; * it = (RscMediaLibItemDesc) btn.Tag; * * if( it.bFolder ) * { * //m_path.Push( it.sFn ); * * //ListFiles(); * } * else * { * //m_txtTitle.Text = "medlib:\\" + it.sFolderPath + "\\" + it.sName; * * m_btnImage.Visibility = Rsc.Visible; * m_btnImage.Tag = it.sIndiciesToItem; * m_btnImage.Image.Source = LoadImage( it, false, 96, 160 ); * } * } */ private ImageSource LoadImage(RscMediaLibItemDesc it, bool bThumbnail, int iCX, int iCY) { if (it.bFolder) { return(m_AppFrame.Theme.GetImage("Images/Ico001_Ressive.jpg")); } // // // PictureAlbum pa = m_media.RootPictureAlbum; Picture pic = null; string [] asInd = it.sIndiciesToItem.Split('|'); int iCnt = asInd.Length; for (int i = 0; i < iCnt; i++) { if (i == iCnt - 1) { pic = pa.Pictures[Int32.Parse(asInd[i])]; } else { pa = pa.Albums[Int32.Parse(asInd[i])]; } } // // // if (bThumbnail) { System.Windows.Media.Imaging.WriteableBitmap wbmp = Microsoft.Phone.PictureDecoder.DecodeJpeg(pic.GetThumbnail(), iCX, iCY); return(wbmp); } else { BitmapImage bmp = new BitmapImage(); bmp.SetSource(pic.GetImage()); return(bmp); } }
private void ReportAlbum(PictureAlbum pa) { string sIndiciesToItem = ""; string sFolderPath = ""; foreach (StackItem si in m_stck) { if (sIndiciesToItem.Length > 0) { sIndiciesToItem += "|"; } sIndiciesToItem += si.Index.ToString(); if (sFolderPath.Length > 0) { sFolderPath += "\\"; } sFolderPath += si.pa.Name; } /* * if( sFolderPath.Length > 0 ) sFolderPath += "\\"; * sFolderPath += pa.Name; */ RscMediaLibItemDesc it = new RscMediaLibItemDesc(); it.bFolder = true; it.sIndiciesToItem = sIndiciesToItem; it.sFolderPath = sFolderPath; it.sName = pa.Name; it.sDetails = ""; it.sDetails += sFolderPath; it.sDetails += "\r\n"; it.sDetails += sIndiciesToItem; it.sDetails += "\r\n"; it.sDetails += "Album count: " + pa.Albums.Count.ToString(); it.sDetails += "\r\n"; it.sDetails += "Picture count: " + pa.Pictures.Count.ToString(); AddFile(it); }
private void AddFile(RscMediaLibItemDesc it) { int idx = spFiles.Children.Count + 1; Grid grdOut = new Grid(); grdOut.Name = "grdOut_" + idx.ToString(); grdOut.Margin = new Thickness(0, 0, 0, 4); RowDefinition rd; rd = new RowDefinition(); rd.Height = GridLength.Auto; grdOut.RowDefinitions.Add(rd); rd = new RowDefinition(); rd.Height = GridLength.Auto; grdOut.RowDefinitions.Add(rd); spFiles.Children.Add(grdOut); Rectangle rc; rc = new Rectangle(); if (it.bFolder) { rc.Fill = new SolidColorBrush(Colors.Orange); } else { rc.Fill = new SolidColorBrush(Colors.Blue); } rc.Opacity = 0.5; rc.SetValue(Grid.RowProperty, 0); grdOut.Children.Add(rc); Button btnMore = new Button(); btnMore.Name = "btnOpen_" + idx.ToString(); btnMore.Content = it.sName; btnMore.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left; btnMore.BorderThickness = new Thickness(0); btnMore.FontSize = 20; btnMore.Foreground = new SolidColorBrush(Colors.White); //.Blue); btnMore.Margin = new Thickness(-12, -10, -12, -12); //btnMore.Tag = it; //btnMore.Opacity = 0.5; btnMore.SetValue(Grid.RowProperty, 0); grdOut.Children.Add(btnMore); Grid grdTit = new Grid(); grdTit.Name = "grdTit_" + idx.ToString(); grdTit.Margin = new Thickness(12, 0, 0, 0); //RowDefinition rd; rd = new RowDefinition(); grdTit.RowDefinitions.Add(rd); grdTit.SetValue(Grid.RowProperty, 1); grdOut.Children.Add(grdTit); TextBox tbDetails = new TextBox(); tbDetails.Name = "tbDet_" + idx.ToString(); tbDetails.FontSize = 16; tbDetails.Text = it.sDetails; tbDetails.Background = new SolidColorBrush(Colors.Gray); tbDetails.Foreground = new SolidColorBrush(Colors.White); tbDetails.Margin = new Thickness(-11, -12, -12, -12); tbDetails.BorderThickness = new Thickness(0, 0, 0, 0); tbDetails.AcceptsReturn = true; tbDetails.TextWrapping = TextWrapping.Wrap; tbDetails.SetValue(Grid.RowProperty, 0); grdTit.Children.Add(tbDetails); Button btn = new Button(); btn.Name = "btnTit_" + idx.ToString(); btn.Content = ""; btn.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right; btn.BorderThickness = new Thickness(0); btn.Foreground = new SolidColorBrush(Colors.White); //.Blue); btn.Margin = new Thickness(-12, -10, -12, -12); //btn.Tag = it; btn.Opacity = 0.5; btn.SetValue(Grid.RowProperty, 1); grdOut.Children.Add(btn); //it.tbTit = tbTit; //it.btn = btn; btnMore.Tag = it; btn.Tag = it; btnMore.Tap += new System.EventHandler <System.Windows.Input.GestureEventArgs>(btn_Tap); btn.Tap += new System.EventHandler <System.Windows.Input.GestureEventArgs>(btn_Tap); /* * btnMore.DoubleTap += new System.EventHandler<System.Windows.Input.GestureEventArgs>(btn_DoubleTap); * btn.DoubleTap += new System.EventHandler<System.Windows.Input.GestureEventArgs>(btn_DoubleTap); */ }