public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     try
     {
         if (values.Length != 2 || !(values[0] is ProjectViewModel) || !(values[1] is Color))
         {
             return((object)null);
         }
         var          explorerSccSolutionInfo = (ProjectViewModel)values[0];
         Color        backgroundColor         = (Color)values[1];
         bool         themeIcon;
         BitmapSource bitmapSourceForFile = TeamFoundationIconStripHelper.Instance.GetBitmapSourceForFile(explorerSccSolutionInfo.ItemPath, out themeIcon);
         if (themeIcon)
         {
             return((object)TeamFoundationIconStripHelper.Instance.ThemeBitmapSource(bitmapSourceForFile, backgroundColor));
         }
         else
         {
             return((object)bitmapSourceForFile);
         }
     }
     catch (Exception ex)
     {
         TeamFoundationTrace.TraceException(TraceKeywordSets.TeamExplorer, ex);
     }
     return((object)null);
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var tfsChangeset = value as ChangesetModel;
                if (tfsChangeset == null)
                {
                    return(String.Empty);
                }

                var comments = tfsChangeset.Comments != null?tfsChangeset.Comments.Trim() : String.Empty;

                if (comments.Length > 1024)
                {
                    comments = comments.Substring(0, 1024) + "...";
                }

                return(comments);
            }
            catch (Exception ex)
            {
                TeamFoundationTrace.TraceException(TraceKeywordSets.TeamExplorer, "ChangesetToolTipMessage.Convert", ex);
            }
            return(null);
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();

                if (value == null || value is byte[] && ((byte[])value).Length == 0)
                {
                    bitmapImage.UriSource = new Uri("pack://application:,,,/Spiral.TfsEssentials2013;component/Resources/IdentityImage.png");
                }
                else
                {
                    var buffer = (byte[])value;
                    bitmapImage.StreamSource = new MemoryStream(buffer);
                }

                bitmapImage.EndInit();

                return(bitmapImage);
            }
            catch (Exception ex)
            {
                TeamFoundationTrace.TraceException(TraceKeywordSets.TeamExplorer, "ImageConverter.Convert", ex);
            }

            return(null);
        }
 private bool AddChangesetByIdCanExecute()
 {
     try
     {
         return(GeChangesetIdsToAdd(ChangesetIdsText).Count > 0);
     }
     catch (Exception ex)
     {
         ShowException(ex);
         TeamFoundationTrace.TraceException(ex);
     }
     return(false);
 }
Ejemplo n.º 5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                if (!(value is int))
                {
                    return(null);
                }

                return((int)value > 20 ? 300.0 : double.PositiveInfinity);
            }
            catch (Exception ex)
            {
                TeamFoundationTrace.TraceException(TraceKeywordSets.TeamExplorer, "ChangesetsSectionListViewMaxHeight.Convert", ex);
            }
            return(null);
        }
Ejemplo n.º 6
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var changeset = value as ChangesetModel;
                if (changeset == null)
                {
                    return(String.Empty);
                }

                return(string.IsNullOrWhiteSpace(changeset.AuthorEmail)
                                        ? String.Format("{0}", changeset.AuthorName)
                                        : String.Format("{0} <{1}>", changeset.AuthorName, changeset.AuthorEmail));
            }
            catch (Exception ex)
            {
                TeamFoundationTrace.TraceException(TraceKeywordSets.TeamExplorer, "ChangesetToolTipAuthor.Converter", ex);
            }
            return(null);
        }