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);
        }
Пример #2
0
        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";
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
        }
Пример #6
0
        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
            }
        }
        //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;
            }
        }
Пример #8
0
 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;
     }
 }
Пример #9
0
        public void FillFeed()
        {
            Feed selectedFeed = findFeed();

            if(selectedFeed != null)
            {
                tbTitle.Text = selectedFeed.Title;
                tbCategory.Text = selectedFeed.Category.Name;
                tbDescription.Text = selectedFeed.Description;
                ImageSourceConverter d = new ImageSourceConverter();

                if (selectedFeed.ImageUrl != null)
                {
                    img.Source = (ImageSource)d.ConvertFromString(selectedFeed.ImageUrl);
                }
                else
                {
                    img.Source = (ImageSource)d.ConvertFromString("http://falger.ca/images/No_image_available.svg.png");
                }

                FillEpisodes(selectedFeed);

            }
        }
Пример #10
0
        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;
        }
Пример #11
0
        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;

            }
            
        }
        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;
        }
Пример #13
0
 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;
                 }
             }
         }
     }
 }
Пример #14
0
        private void image1_MouseLeftButtonDown(object sender, RoutedEventArgs e)
        {

            imageUrl = Environment.CurrentDirectory + Cust_name.Text + ".jpg";
            //  Process.Start(@"E:\Backstroke Proj\CODING\Camera code\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe",imageUrl);

            Process p = new Process();
            // Redirect the output stream of the child process.
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            
            string url=  Environment.CurrentDirectory + "\\" + "camera" + "\\" + "WindowsFormsApplication2.exe";
            MessageBox.Show(url);
            p.StartInfo.FileName = url;
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.Arguments = imageUrl;
            p.Start();

            string output = p.StandardOutput.ReadToEnd();
            p.WaitForExit();
            ImageSourceConverter converter = new ImageSourceConverter();
            image1.Source = (ImageSource)converter.ConvertFromString(imageUrl);
        }
Пример #15
0
 private void ContextMenu_Opened(object sender, RoutedEventArgs e)
 {
     ImageSourceConverter converter = new ImageSourceConverter();
     iconClear.Source = (ImageSource)converter.ConvertFromString("../Images/Clear.png");
     iconCopy.Source = (ImageSource)converter.ConvertFromString("../Images/Copy.png");
     iconPaste.Source = (ImageSource)converter.ConvertFromString("../Images/Paste.png");
 }
Пример #16
0
        private Boolean openMediaFile()
        {
            si.sii("openMediaFile()");
            mediaElementPreview.Stop();
            mediaElementPreview.Source = null;
            mediaElementPreview.Visibility = Visibility.Collapsed;
            imagePreview.Visibility = Visibility.Collapsed;
            string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            if (File.Exists(@appPath + @"\reduced.jpg")) File.Delete(@appPath + @"\reduced.jpg");
            if (File.Exists(@appPath + @"\Snapshot1.jpg")) File.Delete(@appPath + @"\Snapshot1.jpg");
            if (File.Exists(@appPath + @"\Snapshot2.jpg")) File.Delete(@appPath + @"\Snapshot2.jpg");
            if (File.Exists(@appPath + @"\Snapshot3.jpg")) File.Delete(@appPath + @"\Snapshot3.jpg");
            string FilenameAndPath = "";
            string FilenameOnly = "";
            string FileExtensionOnly = "";
            Boolean imageLoaded = false;
            try
            {
                mediaFile.Metadata2 = "";
                mediaFile.Metadata3 = "";
                mediaFile.Metadata4 = "";
                mediaFile.Metadata5 = "";
                mediaFile.Metadata6 = "";
                mediaFile.Metadata7 = "";
                mediaFile.Metadata8 = "";
                mediaFile.Metadata9 = "0.75";

                si.sii("Opening File Dialog");
                OpenFileDialog openFileDialog1 = new OpenFileDialog { /* Set filter options and filter index.*/Filter = "Media Files|*.jpg;*.png;*.wmv;*.avi;*.mpg;*.swf", FilterIndex = 1, Multiselect = false };
                if (openFileDialog1.ShowDialog() == true)
                {
                    FilenameOnly = System.IO.Path.GetFileName(openFileDialog1.FileName);
                    FileExtensionOnly = System.IO.Path.GetExtension(openFileDialog1.FileName);
                    FilenameAndPath = openFileDialog1.FileName;
                    tbImportFileName.Text = FilenameOnly;
                    tbTemplateName4.Text = System.IO.Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
                    if (FileExtensionOnly.ToLower() == ".jpg" || FileExtensionOnly.ToLower() == ".png" || FileExtensionOnly.ToLower() == ".bmp")
                    {
                        spVolume.Visibility = Visibility.Collapsed;
                        tbContenttype.Text = "Image";
                        mediaFile.Contenttype = "Image";
                        FileInfo finfo = new FileInfo(FilenameAndPath);
                        tbFilesize.Text = finfo.Length.ToString();
                        ImageSourceConverter imgConv = new ImageSourceConverter();
                        ImageSource imageSource = (ImageSource)imgConv.ConvertFromString(@FilenameAndPath);
                        imagePreview.Source = imageSource;
                        imagePreview.Visibility = Visibility.Visible;
                        appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                        LPImageLib.ResizeImage(@FilenameAndPath, appPath + @"\reduced.jpg", 75, 55, true);
                        mediaFile.Filelocation = FilenameAndPath;
                        mediaFile.Metadata1 = "10";
                        mediaFile.Name = tbTemplateName4.Text;
                        tbDuration.IsEnabled = true;

                    }
                    else
                    if (FileExtensionOnly.ToLower() == ".mpg" || FileExtensionOnly.ToLower() == ".avi" || FileExtensionOnly.ToLower() == ".wmv" || FileExtensionOnly.ToLower() == ".mp4")
                    {
                        si.sii("Opening video media");
                        try
                        {
                            isMediaOpened = false;
                            spVolume.Visibility = Visibility.Visible;
                            tbContenttype.Text = "Video";
                            mediaFile.Contenttype = "Video";
                            FileInfo finfo = new FileInfo(FilenameAndPath);
                            tbFilesize.Text = finfo.Length.ToString();
                            Uri _mediafile = new Uri(@FilenameAndPath);
                            btnApplyMediaImport.IsEnabled = false;
                            mediaElementPreview.Source = _mediafile;
                            mediaElementPreview.Visibility = Visibility.Visible;
                            appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                            mediaFile.Filelocation = FilenameAndPath;
                            mediaFile.Metadata1 = mediaElementPreview.NaturalDuration.ToString();
                            mediaFile.Name = tbTemplateName4.Text;
                            tbDuration.IsEnabled = false;
                            mediaElementPreview.Play();
                            si.sii("Playing video media");
                            btnApplyMediaImport.IsEnabled = true;
                        }
                        catch (Exception x)
                        {
                            si.six(x);
                        }
                    }
                    else
                    if (FileExtensionOnly.ToLower() == ".swf")
                    {
                        spVolume.Visibility = Visibility.Collapsed;
                        tbContenttype.Text = "Flash";
                        mediaFile.Contenttype = "Flash";
                        FileInfo finfo = new FileInfo(FilenameAndPath);
                        tbFilesize.Text = finfo.Length.ToString();
                        Uri _mediafile = new Uri(@FilenameAndPath);
                        mediaElementPreview.Source = _mediafile;
                        mediaElementPreview.Visibility = Visibility.Visible;
                        appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                        mediaFile.Filelocation = FilenameAndPath;
                        mediaFile.Metadata1 = "n/a";
                        mediaFile.Name = tbTemplateName4.Text;
                        tbDuration.IsEnabled = false;
                    }
                }
                imageLoaded = true;
            }
            catch (Exception ex)
            {
                imageLoaded = false;
                si.six(ex);
                //MessageBox.Show(ex.Message);
            }
            return imageLoaded;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Name.Text = estate.Name.Trim();
            Description.Text = estate.Description.Trim();
            ((TextBox)Fee.Content).Text = estate.Fee.ToString();

            comboBox1.SelectedIndex = 0;
            comboBox1.DataContext = estate;

            byte[] barrImg = (byte[])estate.Photo.ToArray();
            string strfn = Convert.ToString(DateTime.Now.ToFileTime());
            FileStream fs1 = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write);
            fs1.Write(barrImg, 0, barrImg.Length);
            fs1.Flush();
            fs1.Close();
            ImageSourceConverter imgs = new ImageSourceConverter();
            imgScan.SetValue(System.Windows.Controls.Image.SourceProperty, imgs.ConvertFromString(strfn));
        }
Пример #18
0
 void Cliente_Accion()
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         actualizarAdyacentes();
         var converter = new ImageSourceConverter();
         foreach (Image i in adyacentes)
         {
             var source = i.Source.ToString();
             if (source == "..\\..\\..\\Imagenes\\Puerta Cerrada.png")
                 i.Source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Puerta Abierta.png");
             else if (source == "..\\..\\..\\Imagenes\\Llave.png")
             {
                 i.Source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Suelo.png");
                 llave = true;
                 var imagen = stringToImage("KI");
                 MyCanvas.Children.Add(imagen);
             }
         }
     }));
 }
Пример #19
0
        /// <summary>
        /// Gets the image source from path.
        /// </summary>
        /// <param name="imagePath">The image path.</param>
        /// <returns>Returns ImageSource from the path.</returns>
        private static ImageSource GetImageSourceFromPath(string imagePath)
        {
#if(SILVERLIGHT)            
            ImageSourceConverter converter = new ImageSourceConverter();
            return converter.ConvertFromString(imagePath) as ImageSource;
#else
            BitmapImage img = new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute));
            return img;
#endif
        }
Пример #20
0
 /// <summary>
 /// Loads an image.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 private static Image LoadImageFromPath(string path)
 {
     ImageSourceConverter converter = new ImageSourceConverter();
     Image image = new Image();
     image.Source = (ImageSource)converter.ConvertFromString(path);
     return image;
 }
Пример #21
0
        // Testing taking out args deck is never used. Deck deck
        public void ShowCards()
        {
            List<Card> cardList = new List<Card>();
            ImageSourceConverter imgs = new ImageSourceConverter();
            MainWindow window = App.Current.Windows.OfType<MainWindow>().SingleOrDefault(x => x.IsActive);

            RectangleGeometry rect = new RectangleGeometry(new System.Windows.Rect(new System.Windows.Size(363, 250)));
            Image img = new Image();

            img.Height = 60;
            img.Width = 25;
            img.Stretch = Stretch.Fill;

            window.img1.Source = imgs.ConvertFromString("..\\..\\" + deck21[0].getFace()) as ImageSource;
            window.img2.Source = imgs.ConvertFromString("..\\..\\" + deck21[1].getFace()) as ImageSource;
            window.img3.Source = imgs.ConvertFromString("..\\..\\" + deck21[2].getFace()) as ImageSource;
            window.img4.Source = imgs.ConvertFromString("..\\..\\" + deck21[3].getFace()) as ImageSource;
            window.img5.Source = imgs.ConvertFromString("..\\..\\" + deck21[4].getFace()) as ImageSource;
            window.img6.Source = imgs.ConvertFromString("..\\..\\" + deck21[5].getFace()) as ImageSource;
            window.img7.Source = imgs.ConvertFromString("..\\..\\" + deck21[6].getFace()) as ImageSource;
            window.img8.Source = imgs.ConvertFromString("..\\..\\" + deck21[7].getFace()) as ImageSource;
            window.img9.Source = imgs.ConvertFromString("..\\..\\" + deck21[8].getFace()) as ImageSource;
            window.img10.Source = imgs.ConvertFromString("..\\..\\" + deck21[9].getFace()) as ImageSource;
            window.img11.Source = imgs.ConvertFromString("..\\..\\" + deck21[10].getFace()) as ImageSource;
            window.img12.Source = imgs.ConvertFromString("..\\..\\" + deck21[11].getFace()) as ImageSource;
            window.img13.Source = imgs.ConvertFromString("..\\..\\" + deck21[12].getFace()) as ImageSource;
            window.img14.Source = imgs.ConvertFromString("..\\..\\" + deck21[13].getFace()) as ImageSource;
            window.img15.Source = imgs.ConvertFromString("..\\..\\" + deck21[14].getFace()) as ImageSource;
            window.img16.Source = imgs.ConvertFromString("..\\..\\" + deck21[15].getFace()) as ImageSource;
            window.img17.Source = imgs.ConvertFromString("..\\..\\" + deck21[16].getFace()) as ImageSource;
            window.img18.Source = imgs.ConvertFromString("..\\..\\" + deck21[17].getFace()) as ImageSource;
            window.img19.Source = imgs.ConvertFromString("..\\..\\" + deck21[18].getFace()) as ImageSource;
            window.img20.Source = imgs.ConvertFromString("..\\..\\" + deck21[19].getFace()) as ImageSource;
            window.img21.Source = imgs.ConvertFromString("..\\..\\" + deck21[20].getFace()) as ImageSource;
        }
Пример #22
0
        public void RevealCard()
        {
            ImageSourceConverter imgs = new ImageSourceConverter();
            MainWindow window = App.Current.Windows.OfType<MainWindow>().SingleOrDefault(x => x.IsActive);

            RectangleGeometry rect = new RectangleGeometry(new System.Windows.Rect(new System.Windows.Size(363, 250)));
            Image img = new Image();

            img.Height = 60;
            img.Width = 25;
            img.Stretch = Stretch.Fill;
            // after DealNumber is at least 3
            // selected card is the 11th
            window.imgTheCard.Source = imgs.ConvertFromString("..\\..\\" + deck21[10].getFace()) as ImageSource;
        }
Пример #23
0
 public FurikoSmileCollection()
 {
     foreach (string s in smileArray)
     {
         string filepath = "";
         switch (s)
         {
             case ":)":
                 filepath = "smiles/glad.png";
                 break;
             case ":(":
                 filepath = "smiles/sad.png";
                 break;
             case ":D":
                 filepath = "smiles/laugh.png";
                 break;
             case ";)":
                 filepath = "smiles/wink.png";
                 break;
             case ":B":
                 filepath = "smiles/glasses.png";
                 break;
             case ":zzz":
                 filepath = "smiles/sleep.png";
                 break;
             case ":E":
                 filepath = "smiles/evil.png";
                 break;
             case ":O":
                 filepath = "smiles/wow.png";
                 break;
             case ":o":
                 filepath = "smiles/woooaa.png";
                 break;
             case ":lol":
                 filepath = "smiles/lol.png";
                 break;
             case ":love":
                 filepath = "smiles/love.png";
                 break;
             case "<3":
                 filepath = "smiles/heart.png";
                 break;
             case ":p":
                 filepath = "smiles/tongue.png";
                 break;
             case ":up":
                 filepath = "smiles/up.png";
                 break;
             case ":down":
                 filepath = "smiles/down.png";
                 break;
             case ":g":
                 filepath = "smiles/grin.png";
                 break;
             case "T_T":
                 filepath = "smiles/T_T.png";
                 break;
             case ":ok":
                 filepath = "smiles/ok.png";
                 break;
             default:
                 break;
         }
         if (File.Exists(filepath))
         {
             Console.WriteLine("got smilt: {0}", filepath);
             Image img = new Image();
             ImageSourceConverter imgConv = new ImageSourceConverter();
             ImageSource imgSource = (ImageSource)imgConv.ConvertFromString(filepath);
             //img.Source = imgSource;
             //img.Width = 30;
             //img.Height = 30;
             smileTable.Add(s, imgSource);
         }
         else
         {
             Console.WriteLine("file {0} not found", filepath);
         }
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string currentImage = WindowsController.GetCurrentLoginImage();
            ImageSourceConverter converter = new ImageSourceConverter();
            if (!string.IsNullOrEmpty(currentImage))
            {
                ViewModel.SelectedImage = (ImageSource)converter.ConvertFromString(currentImage);
            }

            waitTimer = new System.Timers.Timer(2000) {AutoReset = false};
            waitTimer.Elapsed += (waitTimerSender, waitTimerEventArgs) =>
            {
                waitTimer.Stop();

                ViewModel.InteractionPossible = true;
                MessageBoxResult result = MessageBox.Show(MainResource.msgResizeCompleteBody, MainResource.msgResizeCompleteTitle, MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => btnUpload_Click(null, null)));
                }
            };
        }
Пример #25
0
 public static ImageSource GetImageSource(string imageName)
 {
     #if SILVERLIGHT
     var bmp = new BitmapImage();
     bmp.CreateOptions = BitmapCreateOptions.None;
     var fmt = "Resources/{0}";
     bmp.UriSource = new Uri(string.Format(fmt, imageName), UriKind.Relative);
     return bmp;
     #else
     var imgConv = new ImageSourceConverter();
     string path = string.Format("pack://application:,,,/FlexGridSamples;component/Resources/{0}", imageName);
     return (ImageSource)imgConv.ConvertFromString(path);
     #endif
 }
Пример #26
0
        private void SetContextMenu(bool status)
        {
            ContextMenu menu = ContextMenuService.GetContextMenu(spCaption);
            if (menu != null)
            {
                MenuItem mnItem = menu.Items[0] as MenuItem;
                mnItem.IsEnabled = status;
                return;
            }
            ImageSourceConverter converter = new ImageSourceConverter();
            ContextMenu cm = new ContextMenu();
            MenuItem mnuExcel = new MenuItem();
            mnuExcel.Header = "Excel";
            mnuExcel.Name = "mnuExcel";
            mnuExcel.IsEnabled = status;
            mnuExcel.Click += new RoutedEventHandler(ContextMenuItem_Click);
            mnuExcel.Icon = new Rectangle() { 
                    Width = 16, Height = 16, Fill = new ImageBrush() { 
                    ImageSource = (ImageSource)converter.ConvertFromString("../Images/excel_16.png") 
                    }};
            cm.Items.Add(mnuExcel);

            MenuItem mnuClose = new MenuItem();
            mnuClose.Header = "閉じる";
            mnuClose.Name = "mnuClose";
            mnuClose.Click += new RoutedEventHandler(ContextMenuItem_Click);
            mnuClose.Icon = new Rectangle() { 
                    Width = 16, Height = 16, Fill = new ImageBrush() { 
                    ImageSource = (ImageSource)converter.ConvertFromString("../Images/close_16.png") 
                    }};
            cm.Items.Add(mnuClose);            
            ContextMenuService.SetContextMenu(spCaption, cm);            
        }
Пример #27
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ContextMenu_Opened(object sender, RoutedEventArgs e)
 {
     ImageSourceConverter converter = new ImageSourceConverter();
     iconClose.Source = (ImageSource)converter.ConvertFromString("../Images/close_16.png");
 }
Пример #28
0
 private void DisplayBackground()
 {
     try
     {
         string filen = "";
         string selectedn = "";
         //DAL.Content _background = new DAL.Content();
         foreach (DAL.Content item in contentCollection)
         {
             filen = item.Filelocation;
             if (System.IO.Path.GetExtension(filen) == ".jpg" || System.IO.Path.GetExtension(filen) == ".png")
             {
                 selectedn = item.Filelocation;
             }
         }
         selectedn = @"c:\content\_media\"+System.IO.Path.GetFileName(selectedn);
         ImageSourceConverter imgConv = new ImageSourceConverter();
         ImageSource imageSource = (ImageSource)imgConv.ConvertFromString(@selectedn);
         imageBackground.Source = imageSource;
         imageBackground.Visibility = Visibility.Visible;
     }
     catch (Exception ex)
     {
         Gurock.SmartInspect.SiAuto.Main.LogMessage("Display Background error:"+ex.Message);
     }
 }
Пример #29
0
        /// <summary>
        /// Загрузка изображения
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static ImageSource LoadImage(String filename)
        {
            String path = filename;

            ImageSourceConverter conv = new ImageSourceConverter();
            ImageSource source = conv.ConvertFromString(path) as ImageSource;

            return source;
        }
Пример #30
0
 public Image stringToImage(string s)
 {
     var converter = new ImageSourceConverter();
     ImageSource source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Suelo.png");
     if (s == "X")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Pared.png");
     else if (s == "S")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Salida.png");
     else if (s == "C")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Suelo.png");
     else if (s == "E")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Entrada.png");
     else if (s == "P")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Puerta Cerrada.png");
     else if (s == "K")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Llave.png");
     else if (s == "A")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Ash.png");
     else if (s == "R")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\R.png");
     else if (s == "L")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\L.png");
     else if (s == "U")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\U.png");
     else if (s == "D")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\D.png");
     else if (s == "O")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Pozo.png");
     else if (s == "KI")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Llave Inventario.png");
     else if (s == "Kappa")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Kappa.png");
     else if (s == "Kreygasm")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\Kreygasm.png");
     else if (s == "FrankerZ")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\FrankerZ.png");
     else if (s == "BibleThump")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\BibleThump.png");
     else if (s == "FailFish")
         source = (ImageSource)converter.ConvertFromString(@"..\..\..\Imagenes\FailFish.png");
     var img = new Image()
     {
         Source = source,
         Height = 30,
         Width = 30,
     };
     return img;
 }