Exemplo n.º 1
0
        /// <summary>
        /// Read the arguments for the application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            PureArgument <String> arg = App.Arguments.ArgumentList[App.FILENAMES] as PureArgument <String>;

            if (arg.IsSet)
            {
                try
                {
                    if (File.Exists(arg.ValueList[0] as String))
                    {
                        LoadImage(arg.ValueList[0] as String);
                    }
                    else
                    {
                        throw new Exception("Cannot find the given file!");
                    }

                    if (arg.ValueList.Count > 1)
                    {
                        for (int i = 1; i < arg.ValueList.Count; i++)
                        {
                            Console.WriteLine(this.GetType().Assembly.Location);
                            StartNewInstanceWithImage(arg.ValueList[i]);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ErrorDialogEx.ShowDialog("Error", "The file <" + arg.ValueList[0] + "> cannot be loaded!", ex);
                }
            }
        }
Exemplo n.º 2
0
 public ComponentsWin()
 {
     InitializeComponent();
     fm.ExceptionIsThrown += (s, e) =>
     {
         ErrorDialogEx.ShowDialog("Error", e.AdditionalMessage, e.ThrownException,
                                  NimbusSkin.SkinBundle);
     };
 }
Exemplo n.º 3
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         throw new NotImplementedException("My Exception");
     }
     catch (Exception ee)
     {
         ErrorDialogEx.ShowDialog("My Title", "My Message", ee,
                                  activeBundle);
     }
 }
Exemplo n.º 4
0
        private void LoadImage(String fileName)
        {
            try
            {
                imgPicture.Source = BitmapFrame.Create(new Uri("file://" + fileName));
                imgPicture.Tag    = fileName;

                //Update History
                FileInfo file = new FileInfo(fileName);
                History.Add(file);

                UpdateImageInformations(fileName);
                UpdatePreviewImages();
            }
            catch (IOException e)
            {
                ErrorDialogEx.ShowDialog("Unable to open file", "The file '" + fileName + "' cannot be opened!", e);
            }
        }
        private ImageInfoWindow(BitmapFrame source)
        {
            InitializeComponent();
            MetaData = source.Metadata as BitmapMetadata;

            if ((MetaData == null) || MetaData.IsFrozen)
            {
                gbList.IsEnabled     = false;
                gbMetaData.IsEnabled = false;
            }

            txtRating.AddInputValidator(TextValidator.ValidateInt32, Key.Space);
            //txtDateTaken.AddValidator(TextValidator.ValidateDateTime);
            txtDPIX.AddInputValidator(TextValidator.ValidateDouble, Key.Space);
            txtDPIY.AddInputValidator(TextValidator.ValidateDouble, Key.Space);
            txtSizeX.AddInputValidator(TextValidator.ValidateDouble, Key.Space);
            txtSizeY.AddInputValidator(TextValidator.ValidateDouble, Key.Space);

            txtSizeX.Text = source.PixelWidth.ToString();
            txtSizeY.Text = source.PixelHeight.ToString();
            txtDPIX.Text  = source.DpiX.ToString();
            txtDPIY.Text  = source.DpiY.ToString();

            if (MetaData == null)
            {
                return;
            }

            try
            {
                txtComment.Text   = MetaData.Comment;
                txtCopyright.Text = MetaData.Copyright;
                txtDateTaken.Text = MetaData.DateTaken;
                txtRating.Text    = MetaData.Rating.ToString();
                txtSubject.Text   = MetaData.Subject;
                txtTitle.Text     = MetaData.Title;

                lblFormat.Content   = MetaData.Format;
                lblLocation.Content = MetaData.Location;

                if (MetaData.Author != null)
                {
                    foreach (String str in MetaData.Author)
                    {
                        lstAuthors.Items.Add(str);
                    }
                }
                if (MetaData.Keywords != null)
                {
                    foreach (String str in MetaData.Keywords)
                    {
                        lstKeywords.Items.Add(str);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorDialogEx.ShowDialog("Error", "Cannot read Meta-Data!", e);
                gbList.IsEnabled     = false;
                gbMetaData.IsEnabled = false;
            }
        }