Exemplo n.º 1
0
        private void btnIcon_Click(object sender, EventArgs e)
        {
            if (Loading)
            {
                return;
            }
            ImagePicker.InitialDirectory = I9Gfx.GetPowersetsPath();
            ImagePicker.FileName         = myPS.ImageName;
            if (ImagePicker.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var str = FileIO.StripPath(ImagePicker.FileName);

            if (!File.Exists(FileIO.AddSlash(ImagePicker.InitialDirectory) + str))
            {
                MessageBox.Show(
                    $"You must select an image from the {I9Gfx.GetPowersetsPath()} folder!\r\n\r\nIf you are adding a new image, you should copy it the folder and then select it.",
                    "Ah...", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                myPS.ImageName = str;
                DisplayIcon();
            }
        }
        private bool ChooseReleasePicture(ReleaseData releaseData, int releaseNumber)
        {
            List <ImageViewModel> images = new List <ImageViewModel>();

            foreach (ImageItem imageItem in releaseData.Images)
            {
                ImageViewModel imageViewModel = new ImageViewModel(imageItem);
                images.Add(imageViewModel);
            }

            string title = "Choose image for release " + releaseNumber + "/" + this.totalReleases + " - " + releaseData.Release.JoinedAlbumArtists + " - " + releaseData.Release.Title;

            bool pickResult = false;

            this.waitWindow.Dispatcher.Invoke(() =>
            {
                ImagePicker picker = new ImagePicker(title, images);
                if (picker.ShowDialog() == true)
                {
                    ImageViewModel selectedItem = (ImageViewModel)picker.SelectedItem;
                    this.UpdateImageForRelease(releaseData, selectedItem);
                    pickResult = true;
                }
                else if (picker.IsSkipped)
                {
                    pickResult = true;
                }
                else
                {
                    pickResult = false;
                }
            });

            return(pickResult);
        }
Exemplo n.º 3
0
        private void OnDoubleClickImage(Object sender, ExecutedRoutedEventArgs e)
        {
            String parameter = (String)e.Parameter;

            ImagePicker picker = new ImagePicker(this._assets);

            if (!(picker.ShowDialog() ?? false))
            {
                return;
            }

            if (parameter == "large")
            {
                this._largeAsset       = picker.SelectedAsset;
                this.LargeImage.Source = picker.SelectedAsset.Image;
            }
            else if (parameter == "small")
            {
                this._smallAsset       = picker.SelectedAsset;
                this.SmallImage.Source = picker.SelectedAsset.Image;
            }
            else
            {
                throw new ArgumentOutOfRangeException(
                          $"Expected parameter to be one of \"small\" and \"large\". Received: \"{parameter}\" instead."
                          );
            }
        }
Exemplo n.º 4
0
 /// <summary>Handles loading and changing the Server Icon</summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PFPPictureBox_Click(object sender, EventArgs e)
 {
     if (ImagePicker.ShowDialog() == DialogResult.OK)
     {
         Image NewPFP = Trace.SafeLoadImage(ImagePicker.FileName);
         PFPPictureBox.Image = NewPFP;
         MyTrace.ServerLogo  = NewPFP;
         GeneratePreview();
         Modified = true;
     }
 }
Exemplo n.º 5
0
        private void BackgroundTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (BackgroundTypeComboBox.SelectedIndex)
            {
            case 0:

                //Launch an OpenFileDialog to pick a tile
                if (ImagePicker.ShowDialog() == DialogResult.OK)
                {
                    TileBackground = Trace.SafeLoadImage(ImagePicker.FileName);
                }
                else
                {
                    BackgroundTypeComboBox.SelectedIndex = -1;
                }

                break;

            case 1:

                //Launch the Color Picker from UserForm to pick a color
                UserForm.LoadColors();

                if (UserForm.CardColorPicker.ShowDialog() == DialogResult.OK)
                {
                    TileBackground = new Bitmap(256, 256);
                    using (Graphics GRD = Graphics.FromImage(TileBackground))
                        using (Brush T = new SolidBrush(UserForm.CardColorPicker.Color)) { GRD.FillRectangle(T, 0, 0, 256, 256); }
                }
                else
                {
                    BackgroundTypeComboBox.SelectedIndex = -1;
                }

                UserForm.SaveColors();

                break;

            default:
                break;
            }

            pictureBox1.Image = TileBackground;
        }
Exemplo n.º 6
0
 void btnImage_Click(object sender, EventArgs e)
 {
     if (Loading)
     {
         return;
     }
     ImagePicker.InitialDirectory = I9Gfx.GetEnhancementsPath();
     ImagePicker.FileName         = mySet.Image;
     if (ImagePicker.ShowDialog() == DialogResult.OK)
     {
         string str = FileIO.StripPath(ImagePicker.FileName);
         if (!File.Exists(FileIO.AddSlash(ImagePicker.InitialDirectory) + str))
         {
             int num = (int)Interaction.MsgBox(("You must select an image from the " + I9Gfx.GetEnhancementsPath() + " folder!\r\n\r\nIf you are adding a new image, you should copy it to the folder and then select it."), MsgBoxStyle.Information, "Ah...");
         }
         else
         {
             mySet.Image = str;
             DisplayIcon();
         }
     }
 }
        private bool ChooseReleasePicture(ReleaseData releaseData, int releaseNumber)
        {
            List<ImageViewModel> images = new List<ImageViewModel>();
            foreach (ImageItem imageItem in releaseData.Images)
            {
                ImageViewModel imageViewModel = new ImageViewModel(imageItem);
                images.Add(imageViewModel);
            }

            string title = "Choose image for release " + releaseNumber + "/" + this.totalReleases + " - " + releaseData.Release.JoinedAlbumArtists + " - " + releaseData.Release.Title;

            bool pickResult = false;

            this.waitWindow.Dispatcher.Invoke(() =>
            {
                ImagePicker picker = new ImagePicker(title, images);
                if (picker.ShowDialog() == true)
                {
                    ImageViewModel selectedItem = (ImageViewModel)picker.SelectedItem;
                    this.UpdateImageForRelease(releaseData, selectedItem);
                    pickResult = true;
                }
                else if (picker.IsSkipped)
                {
                    pickResult = true;
                }
                else
                {
                    pickResult = false;
                }
            });

            return pickResult;
        }
Exemplo n.º 8
0
 private void txtPickImage_Click(object sender, EventArgs e) => ImagePicker.ShowDialog();