Пример #1
0
        public void UpdatePersonalInformation()
        {
            txtName.Text   = Personal.USER_INFO.name;
            txtStatus.Text = "(" + ((UserStatus)Personal.USER_INFO.status).ToString() + ")";

            if (Personal.USER_INFO.comment.Length != 0)
            {
                txtQuickMessage.Text = Personal.USER_INFO.comment;
            }
            else
            {
                txtQuickMessage.Text = "Share a quick message";
            }

            imagePartnerFrame.Source = LoadResource.GetAvatarFrameFromStatus((UserStatus)Personal.USER_INFO.status, AvatarSize.Small);

            if (Personal.USER_INFO.avatar != "")
            {
                BitmapImage image = LoadResource.GetAvatar(Personal.USER_INFO.avatar);

                if (image != null)
                {
                    imagePartnerAvatar.Source = LoadResource.Resize(image, 50, 50, BitmapScalingMode.HighQuality);
                }
                else
                {
                    imagePartnerAvatar.Source = LoadResource.Resize(LoadResource.GetDefaultAvatarImage(), 50, 50, BitmapScalingMode.HighQuality);
                }
            }
            else
            {
                imagePartnerAvatar.Source = LoadResource.Resize(LoadResource.GetDefaultAvatarImage(), 50, 50, BitmapScalingMode.HighQuality);
            }

            Window mainWindow = Application.Current.MainWindow;

            if (Personal.USER_INFO.status == 0) // Offline
            {
                mainWindow.Icon = new BitmapImage(new Uri(Resource.Images.Identifiers.APP_ICON_STATUS_OFFLINE, UriKind.Absolute));
            }

            if (Personal.USER_INFO.status == 1) // Busy
            {
                mainWindow.Icon = new BitmapImage(new Uri(Resource.Images.Identifiers.APP_ICON_STATUS_BUSY, UriKind.Absolute));
            }

            if (Personal.USER_INFO.status == 2) // Away
            {
                mainWindow.Icon = new BitmapImage(new Uri(Resource.Images.Identifiers.APP_ICON_STATUS_AWAY, UriKind.Absolute));
            }

            if (Personal.USER_INFO.status == 3) // Available
            {
                mainWindow.Icon = new BitmapImage(new Uri(Resource.Images.Identifiers.APP_ICON_STATUS_AVAILABLE, UriKind.Absolute));
            }

            TextParser.ParseText(txtQuickMessage, false);
            TextParser.ParseText(txtName, false);

            ManageChatWindows.UpdateChatWindowPersonal();
        }