コード例 #1
0
        private void SelectTexture_Click(object sender, RoutedEventArgs e)
        {
            var wnd = new ChildWindow();

            wnd.Owner = this.GetWindow();

            var textureSelector = new TexturePreviewSelector();

            textureSelector.Canceled += (s, ea) => {
                wnd.Close();
            };
            textureSelector.TextureSelected += (s, ea) => {
                wnd.Close();
                Texture = ea.Value;
            };

            wnd.Content = textureSelector;
            wnd.Show();
        }
コード例 #2
0
ファイル: BitmapPickerButton.cs プロジェクト: xorza/NetGL
        protected override void OnClick()
        {
            var dialog = FileDialogHelper.CreateOpenImageDialog();

            if (dialog.ShowDialog(this.GetWindow()) != true)
            {
                return;
            }

            Bitmap bmp;

            try {
                bmp = (Bitmap)Bitmap.FromFile(dialog.FileName);
            }
            catch (Exception ex) {
                ChildWindow.ShowError(ex, this.GetWindow());
                return;
            }
            Bitmap = bmp;

            Refresh();
        }