Exemple #1
0
 private void rcb_ValueChanged(object sender, RoutedEventArgs e)
 {
     ImageChanged?.Invoke(sender, new ImagePickerEventArgs()
     {
         Text = (string)tbMain.Text
     });
 }
Exemple #2
0
        private void refresh()
        {
            bool oldHistory = doHistory;

            doHistory = false;
            name.DataBindings.Clear();
            name.DataBindings.Add("Text", lang, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            Script.DataBindings.Clear();
            Script.DataBindings.Add("Text", lang, "Skript", true, DataSourceUpdateMode.OnPropertyChanged);
            Speakers.DataBindings.Clear();
            Speakers.DataBindings.Add("Text", lang, "TypicalSpeakers", true, DataSourceUpdateMode.OnPropertyChanged);
            source.DataBindings.Clear();
            source.DataBindings.Add("Text", lang, "Source", true, DataSourceUpdateMode.OnPropertyChanged);
            description.DataBindings.Clear();
            NewlineFormatter.Add(description.DataBindings, "Text", lang, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            ImageChanged?.Invoke(this, lang.GetImage());
            preview.Navigate("about:blank");
            preview.Document.OpenNew(true);
            preview.Document.Write(lang.ToHTML());
            preview.Refresh();
            source.AutoCompleteCustomSource.Clear();
            source.AutoCompleteCustomSource.AddRange(SourceManager.Sources.ToArray());
            onChange();
            doHistory = oldHistory;
        }
Exemple #3
0
        private void refresh()
        {
            bool oldHistory = doHistory;

            doHistory = false;
            name.DataBindings.Clear();
            name.DataBindings.Add("Text", cls, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            flavour.DataBindings.Clear();
            NewlineFormatter.Add(flavour.DataBindings, "Text", cls, "Flavour", true, DataSourceUpdateMode.OnPropertyChanged);
            source.DataBindings.Clear();
            source.DataBindings.Add("Text", cls, "Source", true, DataSourceUpdateMode.OnPropertyChanged);
            description.DataBindings.Clear();
            NewlineFormatter.Add(description.DataBindings, "Text", cls, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            features1.features        = cls.Features;
            decriptions1.descriptions = cls.Descriptions;
            traits.DataSource         = new BindingList <TableEntry>(cls.PersonalityTrait);
            ideal.DataSource          = new BindingList <TableEntry>(cls.Ideal);
            bond.DataSource           = new BindingList <TableEntry>(cls.Bond);
            flaw.DataSource           = new BindingList <TableEntry>(cls.Flaw);
            ImageChanged?.Invoke(this, cls.GetImage());
            preview.Navigate("about:blank");
            preview.Document.OpenNew(true);
            preview.Document.Write(cls.ToHTML());
            preview.Refresh();
            source.AutoCompleteCustomSource.Clear();
            source.AutoCompleteCustomSource.AddRange(SourceManager.Sources.ToArray());
            onChange();
            doHistory = oldHistory;
        }
Exemple #4
0
        private void refresh()
        {
            bool oldHistory = doHistory;

            doHistory = false;
            name.DataBindings.Clear();
            name.DataBindings.Add("Text", race, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            flavour.DataBindings.Clear();
            NewlineFormatter.Add(flavour.DataBindings, "Text", race, "Flavour", true, DataSourceUpdateMode.OnPropertyChanged);
            source.DataBindings.Clear();
            source.DataBindings.Add("Text", race, "Source", true, DataSourceUpdateMode.OnPropertyChanged);
            description.DataBindings.Clear();
            NewlineFormatter.Add(description.DataBindings, "Text", race, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            features1.features        = race.Features;
            decriptions1.descriptions = race.Descriptions;
            preview.Navigate("about:blank");
            preview.Document.OpenNew(true);
            preview.Document.Write(race.ToHTML());
            ParentRace.DataBindings.Clear();
            ParentRace.DataBindings.Add("Text", race, "RaceName", true, DataSourceUpdateMode.OnPropertyChanged);
            ImageChanged?.Invoke(this, race.GetImage());
            preview.Refresh();
            source.AutoCompleteCustomSource.Clear();
            source.AutoCompleteCustomSource.AddRange(SourceManager.Sources.ToArray());
            onChange();
            doHistory = oldHistory;
        }
Exemple #5
0
        private void refresh()
        {
            bool oldHistory = doHistory;

            doHistory = false;
            name.DataBindings.Clear();
            name.DataBindings.Add("Text", cls, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            SheetName.DataBindings.Clear();
            SheetName.DataBindings.Add("Text", cls, "SheetName", true, DataSourceUpdateMode.OnPropertyChanged);
            flavour.DataBindings.Clear();
            NewlineFormatter.Add(flavour.DataBindings, "Text", cls, "Flavour", true, DataSourceUpdateMode.OnPropertyChanged);
            source.DataBindings.Clear();
            source.DataBindings.Add("Text", cls, "Source", true, DataSourceUpdateMode.OnPropertyChanged);
            description.DataBindings.Clear();
            NewlineFormatter.Add(description.DataBindings, "Text", cls, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            ParentClass.DataBindings.Clear();
            ParentClass.DataBindings.Add("Text", cls, "ClassName", true, DataSourceUpdateMode.OnPropertyChanged);
            features1.features          = cls.Features;
            featuresFirstClass.features = cls.FirstClassFeatures;
            featuresMultiClass.features = cls.MulticlassingFeatures;
            decriptions1.descriptions   = cls.Descriptions;
            ImageChanged.Invoke(this, cls.GetImage());
            preview.Navigate("about:blank");
            preview.Document.OpenNew(true);
            preview.Document.Write(cls.ToHTML());
            preview.Refresh();
            source.AutoCompleteCustomSource.Clear();
            source.AutoCompleteCustomSource.AddRange(SourceManager.Sources.ToArray());
            MulticlassSpellLevels.Items = cls.MulticlassingSpellLevels;
            onChange();
            doHistory = oldHistory;
        }
 void _thumbnailViewer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ImageChanged != null && _thumbnailViewer.HasSelection)
     {
         ImageChanged.Invoke(this, null);
     }
 }
Exemple #7
0
        private async void lbPictures_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e != null && e.AddedItems.Count > 0)
            {
                var ili = e.AddedItems[0] as ImageListItem;

                ImageUri = $"x-ext://{ili.AppExtensionId}/{ili.File}";

                ImageChanged?.Invoke(sender, new ImagePickerEventArgs()
                {
                    Text           = ImageUri,
                    AppExtensionId = ili.AppExtensionId,
                    File           = ili.File
                });



                //set imagesource
                var el = ExtensionsService.Instance.FindExtensionLiteInstance(ili.AppExtensionId);
                var packageDirectory = el.AppExtension.Package.InstalledLocation;
                var publicDirectory  = await packageDirectory.GetFolderAsync("public");

                var ImageFile = await publicDirectory.GetFileAsync(ili.File);

                var bitmapImage = new BitmapImage();
                using (var stream = await ImageFile.OpenReadAsync())
                {
                    await bitmapImage.SetSourceAsync(stream);
                }
                ImageSource = bitmapImage;
            }
        }
Exemple #8
0
 public void SetImage(PalasoImage image)
 {
     _previousImage = image;
     if (ImageChanged != null)
     {
         ImageChanged.Invoke(this, null);
     }
 }
Exemple #9
0
 public MyImage GetImage()
 {
     if (ans == null)
     {
         ans = GetImageInternal();
         ImageChanged?.Invoke(ans);
     }
     return(ans);
 }
Exemple #10
0
 public void SetImage(Bitmap Image)
 {
     if (item != null)
     {
         item.SetImage(Image);
         ImageChanged?.Invoke(this, Image);
         history?.ShowPreview();
     }
 }
Exemple #11
0
 public virtual void RaiseImageChanged()
 {
     try
     {
         ImageChanged?.Invoke(this, System.EventArgs.Empty);
     }
     catch (Exception ex)
     {
     }
 }
Exemple #12
0
        private void ImageCropper_MouseUp(object sender, MouseEventArgs e)
        {
            _gripperBeingDragged = null;

            _startOfDrag = default(Point);
            if (ImageChanged != null)
            {
                ImageChanged.Invoke(this, null);
            }
        }
 private void OpenFileFromDrag(string path)
 {
     SetMode(Modes.SingleImage);
     _currentImage     = PalasoImage.FromFile(path);
     _pictureBox.Image = _currentImage.Image;
     ImageToolboxSettings.Default.LastImageFolder = Path.GetDirectoryName(path);
     ImageToolboxSettings.Default.Save();
     if (ImageChanged != null)
     {
         ImageChanged.Invoke(this, null);
     }
 }
        private void SetImage(_Image image, bool failIfNull = true)
        {
            ImageChanged?.Invoke(image);

            if (image != null)
            {
                OnImageOpened();
            }
            else if (failIfNull)
            {
                OnImageFailed();
            }
        }
Exemple #15
0
        public void ResizeImage(int width, int height)
        {
            Bitmap image = new Bitmap(width, height);

            using (Graphics g = Graphics.FromImage(image))
            {
                g.InterpolationMode = InterpolationMode.NearestNeighbor;
                g.DrawImage(_image, 0, 0);
            }
            PushResizePage(image);
            SetImage(image);
            image.Dispose();
            ImageChanged?.Invoke(this, EventArgs.Empty);
        }
Exemple #16
0
        public void RescaleImage(int width, int height, InterpolationMode mode)
        {
            Bitmap image = new Bitmap(width, height, PixelFormat.Format32bppPArgb);

            using (Graphics g = Graphics.FromImage(image))
            {
                g.InterpolationMode = mode;
                g.DrawImage(_image, 0, 0, width, height);
            }
            PushResizePage(image);
            SetImage(image);
            image.Dispose();
            ImageChanged?.Invoke(this, EventArgs.Empty);
        }
        private void GetImageFileFromSystem()
        {
            try
            {
                SetMode(Modes.SingleImage);
                // The primary thing that OpenFileDialogWithViews buys us is the ability to default to large icons.
                // OpenFileDialogWithViews still doesn't let us read (and thus remember) the selected view.
                using (var dlg = new OpenFileDialogWithViews(OpenFileDialogWithViews.DialogViewTypes.Large_Icons))
                {
                    if (string.IsNullOrEmpty(ImageToolboxSettings.Default.LastImageFolder))
                    {
                        dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                    }
                    else
                    {
                        dlg.InitialDirectory = ImageToolboxSettings.Default.LastImageFolder;;
                    }

                    dlg.Title = "Choose Picture File".Localize("ImageToolbox.FileChooserTitle", "Title shown for a file chooser dialog brought up by the ImageToolbox");

                    //NB: dissallowed gif because of a .net crash:  http://jira.palaso.org/issues/browse/BL-85
                    dlg.Filter = "picture files".Localize("ImageToolbox.PictureFiles", "Shown in the file-picking dialog to describe what kind of files the dialog is filtering for") + "(*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.bmp)|*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.bmp;";

                    if (DialogResult.OK == dlg.ShowDialog(this.ParentForm))
                    {
                        ImageToolboxSettings.Default.LastImageFolder = Path.GetDirectoryName(dlg.FileName);
                        ImageToolboxSettings.Default.Save();

                        try
                        {
                            _currentImage = PalasoImage.FromFile(dlg.FileName);
                        }
                        catch (Exception err)                         //for example, http://jira.palaso.org/issues/browse/BL-199
                        {
                            ErrorReport.NotifyUserOfProblem(err, "Sorry, there was a problem loading that image.".Localize("ImageToolbox.ProblemLoadingImage"));
                            return;
                        }
                        _pictureBox.Image = _currentImage.Image;
                        if (ImageChanged != null)
                        {
                            ImageChanged.Invoke(this, null);
                        }
                    }
                }
            }
            finally
            {
                _actModal = false;
            }
        }
        private void OnGetFromFileSystemClick(object sender, EventArgs e)
        {
            SetMode(Modes.SingleImage);
#if MONO
            using (var dlg = new OpenFileDialog())
#else
            // The primary thing that OpenFileDialogWithViews buys us is the ability to default to large icons.
            // OpenFileDialogWithViews still doesn't let us read (and thus remember) the selected view.
            using (var dlg = new OpenFileDialogWithViews(OpenFileDialogWithViews.DialogViewTypes.Large_Icons))
#endif
            {
#if __MonoCS__
                // OpenFileDialogWithViews is Windows-only.  Until we need more of its functionality elsewhere,
                // it's much simpler to implement the one method we need here for Mono/Linux.
                SelectLargeIconView(dlg);
#endif
                if (string.IsNullOrEmpty(ImageToolboxSettings.Default.LastImageFolder))
                {
                    dlg.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                }
                else
                {
                    dlg.InitialDirectory = ImageToolboxSettings.Default.LastImageFolder;;
                }

                //NB: dissallowed gif because of a .net crash:  http://jira.palaso.org/issues/browse/BL-85
                dlg.Filter = "picture files".Localize("ImageToolbox.PictureFiles", "Shown in the file-picking dialog to describe what kind of files the dialog is filtering for") + "(*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.bmp)|*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.bmp;";

                if (DialogResult.OK == dlg.ShowDialog())
                {
                    ImageToolboxSettings.Default.LastImageFolder = Path.GetDirectoryName(dlg.FileName);
                    ImageToolboxSettings.Default.Save();

                    try
                    {
                        _currentImage = PalasoImage.FromFile(dlg.FileName);
                    }
                    catch (Exception err)                     //for example, http://jira.palaso.org/issues/browse/BL-199
                    {
                        Palaso.Reporting.ErrorReport.NotifyUserOfProblem(err, "Sorry, there was a problem loading that image.".Localize("ImageToolbox.ProblemLoadingImage"));
                        return;
                    }
                    _pictureBox.Image = _currentImage.Image;
                    if (ImageChanged != null)
                    {
                        ImageChanged.Invoke(this, null);
                    }
                }
            }
        }
Exemple #19
0
        public void PasteInto()
        {
            IDataObject obj = Clipboard.GetDataObject();

            if (obj.GetDataPresent(DataFormats.Bitmap))
            {
                Bitmap img = (Bitmap)obj.GetData("System.Drawing.Bitmap");
                _edit_canvas.DrawImage(img, 0, 0);
                _start_anchor = Point.Empty;
                _end_anchor.X = _image.Width - 1;
                _end_anchor.Y = _image.Height - 1;
                PushHistory();
                ImageChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #20
0
        /// <summary>
        /// 設定を適用する。
        /// </summary>
        /// <param name="model">データモデル</param>
        /// <param name="name">パーツ種別</param>
        /// <param name="partsType">プロパティ名</param>
        private void OnPartsChanged(Character model, PartsType partsType, string propertyName)
        {
            if (propertyName.Equals(nameof(Parts.MaterialName)))
            {
                // 素材自体が変更された。
                // この部品に関係する画像レイヤーを全部削除して追加。
                OnMaterialChanged(model, partsType);
            }
            else
            {
                // この部品に関係する画像レイヤーに設定を適用する。
                OnPartsAttributeChanged(model, partsType, propertyName);
            }

            ImageChanged?.Invoke(this, new EventArgs());
        }
Exemple #21
0
 public void Paste()
 {
     if (FixedSize)
     {
         PasteInto();
     }
     else
     {
         IDataObject obj = Clipboard.GetDataObject();
         if (obj.GetDataPresent(DataFormats.Bitmap))
         {
             Bitmap image = (Bitmap)obj.GetData("System.Drawing.Bitmap");
             PushResizePage(image);
             SetImage(image);
             ImageChanged?.Invoke(this, EventArgs.Empty);
         }
     }
 }
Exemple #22
0
        public void StartGame()
        {
            errorCount = 0;
            Status     = true;
            string path  = "word_rus.txt";
            var    words = File.ReadAllLines(path).Where(s =>
                                                         s.Length >= 5 && s.Length <= 7);

            word = words.Skip(new Random().Next(0, words.Count() - 1)).
                   First();
            chars = word.Select(s => new Char()).ToArray();
            chars[0].Character = word[0];
            chars[0].Unknown   = false;
            chars[word.Length - 1].Character = word[word.Length - 1];
            chars[word.Length - 1].Unknown   = false;
            WordStatusChanged?.Invoke(this, chars);
            ImageChanged?.Invoke(this, 0);
        }
Exemple #23
0
        private async Task AnimatedSetThumbnailSource(BitmapImage image, bool hideBackground = true)
        {
            if (EnableAnimation)
            {
                await FadeOut.BeginAsync();
            }

            Thumbnail.Source = image;
            if (EnableAnimation)
            {
                await FadeIn.BeginAsync();
            }
            if (hideBackground)
            {
                Background = null;
            }
            ImageChanged?.Invoke(this, new MediaThumbnailImageChangedEventArgs {
                IsDefaultImage = !hideBackground
            });
        }
Exemple #24
0
        public void JumpToFrame(int frameIndex)
        {
            if (ImageCount == 0)
            {
                return;
            }
            if (frameIndex >= 0 && frameIndex < ImageCount)
            {
                if (ShowImage == null || ShowImage.Width != Image.Width || ShowImage.Height != Image.Height)
                {
                    ShowImage?.Dispose();
                    ShowImage = new Bitmap(Image.Width, Image.Height);
                }

                FrameDimension fd = Image.GifFrameDimension();
                Image.SelectActiveFrame(fd, frameIndex);
                ShowImage.Graphics().DrawImage(Image, 0, 0, Image.Width, Image.Height);
                ImageChanged?.Invoke(this, ShowImage);
            }
        }
Exemple #25
0
        private void refresh()
        {
            bool oldHistory = doHistory;

            doHistory = false;
            name.DataBindings.Clear();
            name.DataBindings.Add("Text", cls, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            flavour.DataBindings.Clear();
            NewlineFormatter.Add(flavour.DataBindings, "Text", cls, "Flavour", true, DataSourceUpdateMode.OnPropertyChanged);
            source.DataBindings.Clear();
            source.DataBindings.Add("Text", cls, "Source", true, DataSourceUpdateMode.OnPropertyChanged);
            description.DataBindings.Clear();
            NewlineFormatter.Add(description.DataBindings, "Text", cls, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            HD.DataBindings.Clear();
            HD.DataBindings.Add("Value", cls, "HitDie", true, DataSourceUpdateMode.OnPropertyChanged);
            HDCount.DataBindings.Clear();
            HDCount.DataBindings.Add("Value", cls, "HitDieCount", true, DataSourceUpdateMode.OnPropertyChanged);
            HDAverage.DataBindings.Clear();
            HDAverage.DataBindings.Add("Value", cls, "AverageHPPerLevel", true, DataSourceUpdateMode.OnPropertyChanged);
            HDFirst.DataBindings.Clear();
            HDFirst.DataBindings.Add("Value", cls, "HPFirstLevel", true, DataSourceUpdateMode.OnPropertyChanged);
            MulticlassCond.DataBindings.Clear();
            MulticlassCond.DataBindings.Add("Text", cls, "MulticlassingCondition", true, DataSourceUpdateMode.OnPropertyChanged);
            Prestige.DataBindings.Clear();
            Prestige.DataBindings.Add("Checked", cls, "AvailableAtFirstLevel", true, DataSourceUpdateMode.OnPropertyChanged);
            features1.features          = cls.Features;
            featuresFirstClass.features = cls.FirstClassFeatures;
            featuresMultiClass.features = cls.MulticlassingFeatures;
            classFeats.Items            = cls.FeaturesToAddClassKeywordTo;
            classSpells.Items           = cls.SpellsToAddClassKeywordTo;
            ImageChanged?.Invoke(this, cls.GetImage());
            decriptions1.descriptions = cls.Descriptions;
            preview.Navigate("about:blank");
            preview.Document.OpenNew(true);
            preview.Document.Write(cls.ToHTML());
            preview.Refresh();
            source.AutoCompleteCustomSource.Clear();
            source.AutoCompleteCustomSource.AddRange(SourceManager.Sources.ToArray());
            onChange();
            doHistory = oldHistory;
        }
Exemple #26
0
        private void refresh()
        {
            bool oldHistory = doHistory;

            doHistory = false;
            name.DataBindings.Clear();
            name.DataBindings.Add("Text", cls, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            Requirement.DataBindings.Clear();
            Requirement.DataBindings.Add("Text", cls, "Requirement", true, DataSourceUpdateMode.OnPropertyChanged);
            Description.DataBindings.Clear();
            NewlineFormatter.Add(Description.DataBindings, "Text", cls, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            source.DataBindings.Clear();
            source.DataBindings.Add("Text", cls, "Source", true, DataSourceUpdateMode.OnPropertyChanged);
            Base.DataBindings.Clear();
            Base.DataBindings.Add("Text", cls, "Base", true, DataSourceUpdateMode.OnPropertyChanged);
            Slot.DataBindings.Clear();
            Slot.DataBindings.Add("SelectedItem", cls, "Slot", true, DataSourceUpdateMode.OnPropertyChanged);
            Rarity.DataBindings.Clear();
            Rarity.DataBindings.Add("SelectedItem", cls, "Rarity", true, DataSourceUpdateMode.OnPropertyChanged);
            PreName.DataBindings.Clear();
            PreName.DataBindings.Add("Text", cls, "PrependName", true, DataSourceUpdateMode.OnPropertyChanged);
            PostName.DataBindings.Clear();
            PostName.DataBindings.Add("Text", cls, "PostName", true, DataSourceUpdateMode.OnPropertyChanged);
            Attuned.features         = cls.AttunementFeatures;
            Equipped.features        = cls.EquipFeatures;
            Carried.features         = cls.CarryFeatures;
            OnUse.features           = cls.OnUseFeatures;
            AttunedOnUse.features    = cls.AttunedOnUseFeatures;
            AttunedEquipped.features = cls.AttunedEquipFeatures;
            ImageChanged?.Invoke(this, cls.GetImage());
            preview.Navigate("about:blank");
            preview.Document.OpenNew(true);
            preview.Document.Write(cls.ToHTML());
            preview.Refresh();
            source.AutoCompleteCustomSource.Clear();
            source.AutoCompleteCustomSource.AddRange(SourceManager.Sources.ToArray());
            onChange();
            doHistory = oldHistory;
        }
        private void GetFromDevice(ImageAcquisitionService.DeviceKind deviceKind)
        {
            //_pictureBox.Image = SampleImages.sampleScan;
            try
            {
                var acquisitionService = new ImageAcquisitionService(deviceKind);

                var wiaImageFile = acquisitionService.Acquire();
                if (wiaImageFile == null)
                {
                    return;
                }

                var imageFile = ConvertToPngOrJpegIfNotAlready(wiaImageFile);
                _currentImage     = PalasoImage.FromFile(imageFile);
                _pictureBox.Image = _currentImage.Image;

                if (ImageChanged != null)
                {
                    ImageChanged.Invoke(this, null);
                }
            }
            catch (ImageDeviceNotFoundException error)
            {
                _messageLabel.Text = error.Message + Environment.NewLine + Environment.NewLine +
                                     "Note: this program works with devices that have a 'WIA' driver, not the old-style 'TWAIN' driver";
                _messageLabel.Visible = true;
            }
            catch (WIA_Version2_MissingException error)
            {
                _messageLabel.Text    = "Windows XP does not come with a crucial DLL that lets you use a WIA scanner with this program. Get a technical person to downloand and follow the directions at http://vbnet.mvps.org/files/updates/wiaautsdk.zip";
                _messageLabel.Visible = true;
            }
            catch (Exception error)
            {
                Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, "Problem Getting Image".Localize("ImageToolbox.ProblemGettingImageFromDevice"));
            }
        }
Exemple #28
0
 internal void TryWord()
 {
     for (int i = 0; i < chars.Length; i++)
     {
         if (chars[i].Unknown &&
             char.IsLetter(chars[i].Character))
         {
             if (word[i] == chars[i].Character)
             {
                 chars[i].Unknown = false;
                 WordStatusChanged?.Invoke(this, chars);
                 if (chars.FirstOrDefault(s => s.Unknown) == null)
                 {
                     Status = false;
                     System.Windows.MessageBox.Show("Ты крут");
                 }
             }
             else
             {
                 errorCount++;
                 ImageChanged?.Invoke(this, errorCount);
                 if (errorCount == 6)
                 {
                     WordStatusChanged?.Invoke(this,
                                               word.Select(c => new Char
                     {
                         Character = c,
                         Unknown   = false
                     }).ToArray());
                     System.Windows.MessageBox.Show("Вы проиграли");
                     Status = false;
                 }
             }
             return;
         }
     }
 }
Exemple #29
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();

            if (Image == null)
            {
                Active = false;
                return;
            }

            if (IsGif)
            {
                JumpToFrame(FrameIndex);

                if (FrameIndex < ImageCount - 1)
                {
                    FrameIndex++;
                }
                else
                {
                    if (Loop)
                    {
                        FrameIndex = 0;
                    }
                    else
                    {
                        active = false;
                    }
                }
            }
            else
            {
                ImageChanged?.Invoke(this, Image);
            }

            timer.Enabled = IsGif && active;
        }
Exemple #30
0
 public void SetImage(Bitmap Image)
 {
     cls.SetImage(Image);
     ImageChanged?.Invoke(this, Image);
     ShowPreview();
 }