コード例 #1
0
        void CreateProfileTabs()
        {
            ProfileTab.Items.Clear();

            var profiles = new List <Profile>();

            foreach (var profile in Person.Profiles)
            {
                var channel = profile.SourceChannel;

                if (channel != null && channel.Charasteristics.SupportsProfiles)
                {
                    // get channel icon
                    var          assembly           = channel.GetType().Assembly;
                    var          resourceNameFormat = assembly.GetName().Name + ".Resources.icon-13.png";
                    BitmapSource image;

                    using (var stream = assembly.GetManifestResourceStream(resourceNameFormat))
                        image = new PngBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad).Frames[0];

                    // Create profile control for hard profiles
                    var control = new ChannelProfileControl(Person, profile, channel);
                    var tabItem = new TabItem
                    {
                        Content     = control,
                        Icon        = image,
                        AllowDelete = false,
                        Style       = (Style)FindResource("PersonsSocialTabItem"),
                        Header      = ColorConverter.ConvertFromString(ChannelsManager.GetChannelColor(channel)),
                    };

                    ProfileTab.Items.Add(tabItem);
                }
                else
                {
                    profiles.Add(profile);
                }
            }

            // If we have soft profiles for this person show them
            if (profiles.Count > 0)
            {
                var control = new SoftProfilesControl(Person);

                ProfileTab.Items.Add(new TabItem
                {
                    Content     = control,
                    Header      = ColorConverter.ConvertFromString("#757677"),
                    Icon        = _Fallback,
                    AllowDelete = false,
                    Style       = (Style)FindResource("PersonsOtherTabItem")
                });

                control.Profiles.AddRange(profiles);
            }
        }
コード例 #2
0
        void CreateProfileTabs()
        {
            ProfileTab.Items.Clear();

            var profiles = new List<Profile>();

            foreach (var profile in Person.Profiles)
            {
                var channel = profile.SourceChannel;

                if (channel != null && channel.Charasteristics.SupportsProfiles)
                {
                    // get channel icon
                    var assembly = channel.GetType().Assembly;
                    var resourceNameFormat = assembly.GetName().Name + ".Resources.icon-13.png";
                    BitmapSource image;

                    using (var stream = assembly.GetManifestResourceStream(resourceNameFormat))
                        image = new PngBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad).Frames[0];

                    // Create profile control for hard profiles
                    var control = new ChannelProfileControl(Person, profile, channel);
                    var tabItem = new TabItem
                      	{
                      		Content = control,
                            Icon = image,
                            AllowDelete = false,
                            Style = (Style)FindResource("PersonsSocialTabItem"),
                            Header = ColorConverter.ConvertFromString(ChannelsManager.GetChannelColor(channel)),
                      	};

                    ProfileTab.Items.Add(tabItem);
                }
                else
                {
                    profiles.Add(profile);
                }
            }

            // If we have soft profiles for this person show them
            if (profiles.Count > 0)
            {
                var control = new SoftProfilesControl(Person);

                ProfileTab.Items.Add(new TabItem
                 	{
                 		Content = control,
                 		Header = ColorConverter.ConvertFromString("#757677"),
                 		Icon = _Fallback,
                 		AllowDelete = false,
                 		Style = (Style) FindResource("PersonsOtherTabItem")
                 	});

                control.Profiles.AddRange(profiles);
            }
        }