Exemple #1
0
        private void LoadAssemblyButton_Click(object sender, RoutedEventArgs e)
        {
            var parentWindow = Window.GetWindow(this);
            var ofd          = new OpenFileDialog();

            ofd.Filter = "Assemblies (.dll,.exe)|*.dll;*.exe|All Files (.*)|*.*";
            if (ofd.ShowDialog(parentWindow) != true)
            {
                return;
            }

            Assembly loadedAssembly = null;

            try {
                loadedAssembly = Assembly.LoadFrom(ofd.FileName);
            }
            catch (Exception ex) {
                ChildWindow.ShowError(ex, parentWindow);
            }

            if (loadedAssembly != null)
            {
                AddAssembly(loadedAssembly);
            }
        }
Exemple #2
0
        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();
        }