public Criatura(int _id, string _tipo, double X, double Y) { InitializeComponent(); this.id = _id; this.tipo = _tipo; var converter = new ImageSourceConverter(); var eruditoSource = (ImageSource)converter.ConvertFromString(@"..\..\Imagenes\EruditoFadic.png"); var soldadoSource = (ImageSource)converter.ConvertFromString(@"..\..\Imagenes\SoldadoZodto.png"); var ermitanoSource = (ImageSource)converter.ConvertFromString(@"..\..\Imagenes\ermitanio.png"); var elegidoSource = (ImageSource)converter.ConvertFromString(@"..\..\Imagenes\Elegido.png"); if (tipo == "soldado") { icono.Source = soldadoSource; } else if (tipo == "erudito") { icono.Source = eruditoSource; } else if (tipo == "ermitano") { icono.Source = ermitanoSource; } else if (tipo == "elegido") { icono.Source = elegidoSource; } Canvas.SetLeft(this, X); Canvas.SetTop(this, Y); }
private void Click1(object sender, RoutedEventArgs e) { ViewModel.GenerateIsomorphic(); ImageSourceConverter imgConv = new ImageSourceConverter(); string path = string.Format("{0}.png", ViewModel.m_Isomorphic.m_Name); ImageSource imageSource = (ImageSource)imgConv.ConvertFromString(path); Image3.Source = imageSource; if (ViewModel.m_Isomorphic.m_Name == @"C:\graphviz-2.32\release\bin\m_isomorphic") { File.Delete(@"C:\graphviz-2.32\release\bin\m_isomorphic2"); ViewModel.m_Isomorphic.m_Name = @"C:\graphviz-2.32\release\bin\m_isomorphic2"; } else if (ViewModel.m_Isomorphic.m_Name == @"C:\graphviz-2.32\release\bin\m_isomorphic3") { File.Delete(@"C:\graphviz-2.32\release\bin\m_isomorphic"); ViewModel.m_Isomorphic.m_Name = @"C:\graphviz-2.32\release\bin\m_isomorphic"; } else if (ViewModel.m_Isomorphic.m_Name == @"C:\graphviz-2.32\release\bin\m_isomorphic2") { File.Delete(@"C:\graphviz-2.32\release\bin\m_isomorphic3"); ViewModel.m_Isomorphic.m_Name = @"C:\graphviz-2.32\release\bin\m_isomorphic3"; } }
public MainPage() { InitializeComponent(); button_Alchemy.Background = new SolidColorBrush(Colors.Green); button_Cornucopia.Background = new SolidColorBrush(Colors.Green); button_Dominion.Background = new SolidColorBrush(Colors.Green); button_Hinterlands.Background = new SolidColorBrush(Colors.Green); button_Intrigue.Background = new SolidColorBrush(Colors.Green); button_PromoCards.Background = new SolidColorBrush(Colors.Green); button_Prosperity.Background = new SolidColorBrush(Colors.Green); button_Seaside.Background = new SolidColorBrush(Colors.Green); m_Dominion = true; m_Intrigue = true; m_Alchemy = true; m_Hinterlands = true; m_Cornucopia = true; m_PromoCards = true; m_Seaside = true; m_Prosperity = true; converter = new ImageSourceConverter(); Cards = new Dictionary<string, List<string>>(); index = 0; LoadCards(); //for (int i = 0; i < Cards.Count; i++) // for (int j = 0; j < Cards.ElementAt(i).Value.Count; j++) // converter.ConvertFromString("Cards/" + Cards.ElementAt(i).Value[j] + ".jpg"); }
public Popup(String heading, String body, String imageSource, Int32 numPopups) { InitializeComponent(); this.Left = SystemParameters.WorkArea.Width - this.Width; this.Top = SystemParameters.WorkArea.Height - (this.Height * (numPopups + 1)); tweetText.Text = body; userName.Text = heading; ImageSourceConverter conv = new ImageSourceConverter(); avatarImage.Source = (ImageSource)conv.ConvertFromString(imageSource); this.Topmost = true; sbFadeOut = (Storyboard)FindResource("sbFadeOut"); sbFadeOut.Completed += new EventHandler(sbFadeOut_Completed); DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(); Storyboard.SetTargetName(animation, "MainGrid"); Storyboard.SetTargetProperty(animation, new PropertyPath(UIElement.OpacityProperty)); animation.KeyFrames.Add(new SplineDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)))); animation.KeyFrames.Add(new SplineDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(Double.Parse(Properties.Settings.Default.NotificationDisplayTime))))); animation.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(Double.Parse(Properties.Settings.Default.NotificationDisplayTime) + 1)))); sbFadeOut.Children.Add(animation); ShowPopup = (Storyboard)FindResource("ShowPopup"); ShowPopup.Completed += new EventHandler(ShowPopup_Completed); ShowPopup.Begin(this, true); }
public MainWindow() { InitializeComponent(); writer = new TextBoxWriter(OutputBox); Console.SetOut(writer); imageConverter = new ImageSourceConverter(); }
public void ConvertFromUri () { Uri uri = new Uri ("tester.com", UriKind.Relative); ImageSourceConverter c = new ImageSourceConverter (); var converted = c.ConvertFrom (uri); Assert.IsInstanceOfType<BitmapImage> (converted, "#1"); Assert.AreEqual (uri, ((BitmapImage) converted).UriSource, "#2"); }
public static ImageSource ImageToSource(Image image) { MemoryStream stream = new MemoryStream(); image.Save(stream, System.Drawing.Imaging.ImageFormat.Png); System.Windows.Media.ImageBrush imageBrush = new System.Windows.Media.ImageBrush(); System.Windows.Media.ImageSourceConverter imageSourceConverter = new System.Windows.Media.ImageSourceConverter(); return((System.Windows.Media.ImageSource)imageSourceConverter.ConvertFrom(stream)); }
public UcToggleButtonLock() { InitializeComponent(); //had to use the "pack" resource URI format per this: (look for "ParserContext") //http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/10f84d55-0670-44c5-9670-8262d3719db4 UpImage = new ImageSourceConverter().ConvertFromString("pack://application:,,,/Assets/Glyphs/locked.png") as ImageSource; DownImage = new ImageSourceConverter().ConvertFromString("pack://application:,,,/Assets/Glyphs/unlocked.png") as ImageSource; }
public WaitingWindow() { InitializeComponent(); this.Background = new SolidColorBrush(Color.FromRgb(188, 99, 163)); MemoryStream stream = new MemoryStream(); Properties.Resources.lrc.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); this.Icon = (ImageSource)imageSourceConverter.ConvertFrom(stream); canCLose = false; }
public void ConvertFromString_Absolute () { ImageSourceConverter c = new ImageSourceConverter (); var converted = c.ConvertFrom ("http://example.com/image.jpg"); Assert.IsInstanceOfType<BitmapImage> (converted, "#1"); Uri uri = ((BitmapImage) converted).UriSource; Assert.AreEqual (new Uri ("http://example.com/image.jpg", UriKind.Absolute), uri, "#2"); Assert.IsTrue (uri.IsAbsoluteUri, "#3"); }
public void ConvertFromString_Relative () { ImageSourceConverter c = new ImageSourceConverter (); var converted = c.ConvertFrom ("string"); Assert.IsInstanceOfType<BitmapImage> (converted, "#1"); Uri uri = ((BitmapImage) converted).UriSource; Assert.AreEqual (new Uri ("string", UriKind.Relative), uri, "#2"); Assert.IsFalse (uri.IsAbsoluteUri, "#3"); }
/// <summary> 转换 Bitmap 到 ImageSource /// Imaging.CreateBitmapSourceFromHBitmap 具有相同的功能,此项是通过数据流进行转换</summary> /// <param name="bitmap">将要转换的 Bitmap </param> /// <returns>转换后的 ImageSource </returns> public static ImageSource ConvertImageSource(this Bitmap bitmap) { using (MemoryStream stream = new MemoryStream()) { bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageBrush imageBrush = new ImageBrush(); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); return (ImageSource)imageSourceConverter.ConvertFrom(stream); } }
private void Grid_Loaded(object sender, RoutedEventArgs e) { try{ ImageSourceConverter isc = new ImageSourceConverter(); string strDir = @"C:\ProgramData\MyIPWebcamTimeLapse\MyIPWebcamTimeLapse\1.0.0.4\192.168.1.13\20130311\"; Action act = new Action(() => { try { foreach (string fil in System.IO.Directory.EnumerateFiles(strDir)) { if (!liss.ContainsKey(fil)) { ImageSource iss = isc.ConvertFromString(fil) as ImageSource; liss.Add(fil, iss); } } } catch (Exception ec) { string sdsldkfjsldkjf = ec.Message; } }); act.Invoke(); int i = 0; TimerCallback tc = new TimerCallback((a) => { act.Invoke(); try { SetImageCallback d = new SetImageCallback((ims,_i)=>{ image1.Source = ims; this.Title =_i+"."+ System.DateTime.Now.ToString("HH:mm:ss"); }); this.Dispatcher.Invoke(d,liss.Select(x => x.Value).ToArray()[i],i); } catch (Exception ex) { string s = ex.Message; } i++; if(i == liss.Count) i=1; }); System.Threading.Timer tim = new Timer(tc,null,0,50); } catch (Exception ec) { string sdsldkfjsldkjf = ec.Message; } }
public SettingWindow() { InitializeComponent(); this.Background = new SolidColorBrush(Color.FromRgb(213, 133, 191)); MemoryStream stream = new MemoryStream(); Properties.Resources.lrc.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); this.Icon = (ImageSource)imageSourceConverter.ConvertFrom(stream); this.textBlock1.Text = Settings.Settings.Default.lrcDirectory; this.textBlock1.ToolTip = this.textBlock1.Text; }
public FolderBrowerDialog(Window window) { InitializeComponent(); this.Owner = window; userSelectStatus = new _UserSelectStatus(); userSelectStatus.cancel = true; userSelectStatus.selectedPath = ""; MemoryStream stream = new MemoryStream(); Properties.Resources.lrc.Save(stream, System.Drawing.Imaging.ImageFormat.Png); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); this.Icon = (ImageSource)imageSourceConverter.ConvertFrom(stream); }
public PaginaUser(BusyIndicator bIndic,List<ServiceReference1.LoginFunction_Result> lista,MapLayers mymap,Map map,Canvas canvas2) { InitializeComponent(); this.canvas2 = canvas2; this.mymap = mymap; this.map = map; this.bInidic = bIndic; #region Adresa + Nume animal ControlCuColturiRotunde adresscur = new ControlCuColturiRotunde(LayoutRoot, 230, 100, 0, 7, true, 1); adresscur.Colturi(13, 13, new Rect(0, 0, 230, 100)); adresscur.Colors("#FFF0F8FF", "#FFF0F8FF", new Point(0.5, 1), new Point(0.5, 0), 0.3); // ControlCuColturiRotunde dd = new ControlCuColturiRotunde(can, 200, 100, 200, 100, false, 1); Canvas wrap = new Canvas() { Margin = new Thickness(12, 12, 12, 12), Width = 210, Height = 70 }; tb1 = new TextBlock() { Text = "You are here: ", Margin = new Thickness(0, 1, 0, 0), FontFamily = new FontFamily("Tahoma"), FontSize = 12, Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 42, 116)) }; tb2 = new TextBlock() { Text = "Regiunea Curenta", Margin = new Thickness(tb1.ActualWidth + 1, 1, 0, 0), FontFamily = new FontFamily("Tahoma"), FontSize = 12, Foreground = new SolidColorBrush(Colors.Black), Cursor = Cursors.Hand }; tb3 = new TextBlock() { Text = " >> ", Margin = new Thickness(tb1.ActualWidth + tb2.ActualWidth + 2, 1, 0, 0), FontFamily = new FontFamily("Comic Sans MS"), FontWeight = FontWeights.SemiBold, FontSize = 8, Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 42, 116)) }; tb4 = new TextBlock() { Text = "Subregiunea", Margin = new Thickness(tb1.ActualWidth + tb2.ActualWidth + tb3.ActualWidth + 3, 1, 0, 0), FontFamily = new FontFamily("Tahoma"), FontSize = 12, Foreground = new SolidColorBrush(Colors.Black), Cursor = Cursors.Hand }; if (tb4.Margin.Left + tb4.ActualWidth > 210)//trecere urm rand tb4.Margin = new Thickness(15, 18, 0, 0); tb5 = new TextBlock() { Text = " >> ", Margin = new Thickness(tb4.Margin.Left != 0 ? tb4.ActualWidth + 16 : 15, 18, 0, 0), FontFamily = new FontFamily("Comic Sans MS"), FontWeight = FontWeights.SemiBold, FontSize = 8, Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 42, 116)) }; if (tb4.Margin.Left != 15) tb5.Margin = new Thickness(15, 18, 0, 0); tb6 = new TextBlock() { Text = "Zona Campie/Padure", Margin = new Thickness(tb5.Margin.Left + tb5.ActualWidth + 1, 18, 0, 0), FontFamily = new FontFamily("Tahoma"), FontSize = 12, Foreground = new SolidColorBrush(Colors.Black), Cursor = Cursors.Hand }; //TextBlock tb7 = new TextBlock() { Text = " >> ", Margin = new Thickness(tb6.Margin.Left + tb6.ActualWidth + 1, 18, 0, 0), FontFamily = new FontFamily("Comic Sans MS"), FontWeight = FontWeights.SemiBold, FontSize = 8, Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 42, 116)) }; //TextBlock tb8 = new TextBlock() { Text = "Animals", Margin = new Thickness(tb7.Margin.Left + tb7.ActualWidth + 1, 18, 0, 0), FontFamily = new FontFamily("Tahoma"), FontSize = 12, Foreground = new SolidColorBrush(Colors.Black), Cursor = Cursors.Hand }; wrap.Children.Add(tb1); wrap.Children.Add(tb2); wrap.Children.Add(tb3); wrap.Children.Add(tb4); wrap.Children.Add(tb5); wrap.Children.Add(tb6); //wrap.Children.Add(tb7); wrap.Children.Add(tb8); LayoutRoot.Children.Add(wrap); TextBlock tb9 = new TextBlock() { Text = "Welcome,", Margin = new Thickness(12, 48, 12, 12), FontFamily = new FontFamily("Tahoma"), FontSize = 12, Foreground = new SolidColorBrush(Colors.Black) }; TextBlock tb10 = new TextBlock() { Text = lista[0].Nume, Margin = new Thickness(12, 58, 12, 12), FontFamily = new FontFamily("Tahoma"), FontSize = 23, Foreground = new SolidColorBrush(Colors.Black) }; LayoutRoot.Children.Add(tb9); LayoutRoot.Children.Add(tb10); #endregion ImageSourceConverter c = new ImageSourceConverter(); image1.Source = (ImageSource)c.ConvertFromString("Game/deer.jpg"); Donatii.Text = lista[0].NrDonatii.ToString() + " Donations"; Banidonati.Text = lista[0].BaniDonati.ToString() + " RON donated"; Rank.Text = "Rank: "+lista[0].Rank.ToString(); Scor.Text = "Scor: " + lista[0].Scor; mymap.lol(); bIndic.IsBusy = false; // Alex // Evenimente tb2.MouseLeftButtonUp += new MouseButtonEventHandler(tb2_MouseLeftButtonUp); // Update region updateCurrentRegion(); // Store the current instance instance = this; }
public SingleBlogItem() { InitializeComponent(); var blogItem = App.ViewModel.BlogItems.Where(b => b.ID == App.ViewModel.ClickedBlog).SingleOrDefault(); PageTitle.Text = blogItem.Title; ImageSourceConverter imgs=new ImageSourceConverter(); BlogImage.SetValue(Image.SourceProperty, imgs.ConvertFromString(blogItem.ImageSource)); textBlock1.Text = blogItem.Content; }
protected override void OnNavigatedTo(NavigationEventArgs e) { try { string value = null; if (NavigationContext.QueryString.TryGetValue("ItemId", out value)) { int index = int.Parse(value); //Make sure the data is loaded for main view model (this is to ensure we get proper item when coming from Pinned Tile) if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } ItemViewModel item = App.ViewModel.GetItem(index); if (item != null) { TextBlockSelectedItemTitle.Text = item.mainitems; ImageSourceConverter imgS = new ImageSourceConverter(); ImageSelectedItem.Source = (ImageSource)imgS.ConvertFromString(item.ItemImage); if (!App.SubviewModel.IsDataLoaded) { App.SubviewModel.LoadData(); } foreach (SubItemViewModel subItem in App.SubviewModel.SubItems) { subItem.MyColor = item.Color; } SubItemsListBox.ItemsSource = from SubItems in App.SubviewModel.SubItems where SubItems.ItemId1 == index select SubItems; } } } catch (Exception ex) { //Do Nothing } }
public void setNewIconPath(string iconPath) { if (File.Exists(iconPath)) { ImageSourceConverter imgConv = new ImageSourceConverter(); ImageSource imageSource = (ImageSource)imgConv.ConvertFromString(iconPath); imageIcon.Source = imageSource; imageIcon.Visibility = Visibility.Visible; } else { imageIcon.Visibility = Visibility.Hidden; } }
//This method handles the different ways an image can be stored in plugin datas public static Image ProcessImage( object imageData ) { Image image = new Image(); string imageString = imageData.ToString(); if( imageData.GetType() == typeof( Image ) ) { //If a WPF image was stored in the PluginDatas, we use its source to create a NEW image instance, to enable using it multiple times. Image img = new Image(); BitmapImage bitmapImage = new BitmapImage( new Uri( ( (Image)imageData ).Source.ToString() ) ); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; img.Source = bitmapImage; return img; } else if( imageString.Length <= 260 && Uri.IsWellFormedUriString( imageString, UriKind.RelativeOrAbsolute ) && !imageString.StartsWith( "pack://" ) && File.Exists( imageString ) ) //Handles URis { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = new Uri( imageString ); bitmapImage.EndInit(); image.Source = bitmapImage; return image; } else if( imageString.StartsWith( "pack://" ) ) //Handles the WPF "pack://" protocol { Image img = new Image(); ImageSourceConverter imsc = new ImageSourceConverter(); img.Source = (ImageSource)imsc.ConvertFromString( imageString ); return img; } else { byte[] imageBytes = Convert.FromBase64String( imageData.ToString() ); //Handles base 64 encoded images using( MemoryStream ms = new MemoryStream( imageBytes ) ) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = ms; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); image.Source = bitmapImage; } return image; } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ImageSource source = new ImageSourceConverter().Convert(value, targetType, parameter, culture) as ImageSource; if (source == null) return value; ImageBrush brush = new ImageBrush(); brush.ImageFailed += delegate { }; brush.ImageSource = source; if (parameter is Stretch) brush.Stretch = (Stretch)parameter; else brush.Stretch = Stretch.Uniform; return brush; }
public BeezleDisplay() { InitializeComponent(); if (File.Exists(imagePath)) { ImageSourceConverter imgConv = new ImageSourceConverter(); string path = imagePath; ImageSource imageSource = (ImageSource)imgConv.ConvertFromString(path); imageIcon.Source = imageSource; } imageProgressBar.Visibility = Visibility.Collapsed; imageProgressBack.Visibility = Visibility.Collapsed; labelText.Visibility = Visibility.Collapsed; }
static ImageResources() { var streamResourceInfo = Application.GetResourceStream(new Uri(CallWallIconPath)); if (streamResourceInfo != null) { var iconStream = streamResourceInfo.Stream; CallWallIcon = new Icon(iconStream); } var conv = new ImageSourceConverter(); if (conv.CanConvertFrom(typeof(string))) { CallWallLogoSource = (ImageSource)conv.ConvertFrom(CallWallLogoPath); CallWallImageSource = (ImageSource)conv.ConvertFrom(CallWallIconPath); BirthdayImageSource = (ImageSource)conv.ConvertFrom(BirthdayPath); } }
public MainWindow() { InitializeComponent(); //folder icon init ImageSourceConverter c = new ImageSourceConverter(); folderIcon = (ImageSource)c.ConvertFrom("pack://application:,,,/img/folderImage.png"); entry = new Entry(); ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE InterfaceType='USB'"); foreach (ManagementObject currentObject in theSearcher.Get()) { ManagementObject theSerialNumberObjectQuery = new ManagementObject("Win32_PhysicalMedia.Tag='" + currentObject["DeviceID"] + "'"); MessageBox.Show(theSerialNumberObjectQuery["SerialNumber"].ToString()); } //Request = new RequestManager(); //watcher = new FileSystemWatcher(); }
private async Task<ImageSource> LoadImageSourceAsync(string address) { ImageSource imgSource = null; try { string url = EncodeUrl(address); MemoryStream ms = new MemoryStream(await new WebClient().DownloadDataTaskAsync(new Uri(url))); ImageSourceConverter imageSourceConverter = new ImageSourceConverter(); imgSource = (ImageSource)imageSourceConverter.ConvertFrom(ms); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } return imgSource; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BitmapSource bitmapSource = null; var uri = value as Uri; if (uri != null) { bitmapSource = new ImageSourceConverter().ConvertFrom(uri) as BitmapSource; } if (bitmapSource == null) { bitmapSource = value as BitmapSource; } if (bitmapSource != null) { BitmapSource orgBmp = bitmapSource; if (orgBmp.Format == PixelFormats.Bgra32) { byte[] orgPixels = new byte[orgBmp.PixelHeight * orgBmp.PixelWidth * 4]; byte[] newPixels = new byte[orgPixels.Length]; orgBmp.CopyPixels(orgPixels, orgBmp.PixelWidth * 4, 0); for (int i = 3; i < orgPixels.Length; i += 4) { int grayVal = ((int)orgPixels[i - 3] + (int)orgPixels[i - 2] + (int)orgPixels[i - 1]); if (grayVal != 0) grayVal = grayVal / 3; newPixels[i] = orgPixels[i]; //Set AlphaChannel newPixels[i - 3] = (byte)grayVal; newPixels[i - 2] = (byte)grayVal; newPixels[i - 1] = (byte)grayVal; } return BitmapSource.Create(orgBmp.PixelWidth, orgBmp.PixelHeight, 96, 96, PixelFormats.Bgra32, null, newPixels, orgBmp.PixelWidth * 4); } } return value; }
public MainWindow() { InitializeComponent(); //folder icon init ImageSourceConverter c = new ImageSourceConverter(); folderIcon = (ImageSource)c.ConvertFrom("pack://application:,,,/img/folderImage.png"); //ContentManager.FileData fd = new ContentManager.FileData { FileName = "Test", FullPathStr = "C:\\Users\\Sohee\\Desktop\\Test" }; //EntryElement ee = new EntryElement(EntryType.Folder, fd); //e = new Entry(ee); //e.makeEntry(); //에러발생 //this.e.Meta.addKey("test1"); //this.e.Meta.addKey("test2"); //this.e.Meta.addKey("test3"); //this.e.Meta.addKey("test4"); //디폴트화면이 default가 아닌 경우 아래의 소스 필요 //Category_TaglistBox.ItemsSource = this.e.Meta.getKeys(); }
public ViewWindow(file filename) { InitializeComponent(); if (filename.Name.EndsWith("xlsx")) { SheetList.Visibility = Visibility.Visible; dataGrid.Visibility = Visibility.Visible; fsc.GetExcelDocumentCompleted += (a, b) => { Exceldocument = b.Result; SheetList.SetBinding(ListBox.ItemsSourceProperty, new Binding("WorkSheets") { Source = Exceldocument, BindsDirectlyToSource = true, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.Default }); }; fsc.GetExcelDocumentAsync(filename.Name); } else if (filename.Name.EndsWith("pdf")) { UriBuilder ub = new UriBuilder(fsc.Endpoint.Address.Uri.AbsoluteUri.Replace("FileService.svc", "sender.ashx")); ub.Query = string.Format("filename={0}", filename.Name); webbrowser.Visibility = Visibility.Visible; webbrowser.NavigateToString("<html><body><iframe src='"+ ub.Uri.AbsoluteUri +"&mime=true' id='ifrm' style='width:100%;height:100%;border:solid 10px green;margin:0;padding:0;'></iframe></body></html>"); } else if (filename.Name.ToLower().EndsWith("jpg")) { UriBuilder ub = new UriBuilder(fsc.Endpoint.Address.Uri.AbsoluteUri.Replace("FileService.svc", "sender.ashx")); ub.Query = string.Format("filename={0}", filename.Name); ImageSourceConverter isc = new ImageSourceConverter(); image.Source= isc.ConvertFromString(ub.Uri.OriginalString) as ImageSource; image.Visibility = Visibility.Visible; } }
void sv_ScrollChanged(object sender, ScrollChangedEventArgs e) { foreach (Border img in photocanvas.Children) { if (img != null) { Image photo = (img.Child as Image); if (photo != null && photo.Source == null && photo.Tag != null) { ScrollViewer sv = (photocanvas.Parent as ScrollViewer); double dv = sv.VerticalOffset; double dh = sv.ActualHeight; double mt = double.Parse(img.GetValue(Canvas.TopProperty).ToString()); if (mt >= dv && mt < (dh + dv + img.ActualHeight)) { string url = photo.Tag.ToString(); ImageSourceConverter isc = new ImageSourceConverter(); photo.Source = isc.ConvertFromString(url) as ImageSource; } } } } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BitmapSource bitmapSource = null; var uri = value as Uri; if (uri != null) { var imageSourceConverter = new ImageSourceConverter(); var imageSource = imageSourceConverter.ConvertFrom(uri); bitmapSource = imageSource as BitmapSource; } if (bitmapSource == null) { bitmapSource = value as BitmapSource; } if (bitmapSource != null) { var converter = GetConverter(bitmapSource.Format); return converter.Convert(bitmapSource); } return value; }
private void header_color_combobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem item = (ComboBoxItem)header_color_combobox.SelectedItem; var img = ""; string content = item.Content.ToString(); switch (content) { case "Noir": img = "header_black.jpg"; break; case "Blue": img = "header_blue.jpg"; break; case "Gris": img = "header_gray.jpg"; break; case "Vert": img = "header_green.jpg"; break; case "Rose": img = "header_pink.jpg"; break; case "Rouge": img = "header_red.jpg"; break; case "Blue ciel": img = "header_skyblue.jpg"; break; } ImageSourceConverter imgConv = new ImageSourceConverter(); string path = "pack://application:,,/Images/Headers/" + img; ImageSource imageSource = (ImageSource) imgConv.ConvertFromString(path); _headerImage.Source = imageSource; }