Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (UnlockedDescription.Length != 0)
            {
                hash ^= UnlockedDescription.GetHashCode();
            }
            if (Disabled != false)
            {
                hash ^= Disabled.GetHashCode();
            }
            if (ShowBadge != false)
            {
                hash ^= ShowBadge.GetHashCode();
            }
            if (visibilityConditions_ != null)
            {
                hash ^= VisibilityConditions.GetHashCode();
            }
            if (unlockConditions_ != null)
            {
                hash ^= UnlockConditions.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        public void Prepare()
        {
            _socket?.Disconnect();
            onSocketRestartEvent?.Invoke(this, EventArgs.Empty);
            try
            {
                var initObject = new InitObject
                {
                    LatLon           = new[] { _userLatLon.Longitude, _userLatLon.Latitude },
                    DistanceTreshold = DistanceTreshold,
                    DeviceType       = ".NET CLIENT",
                    Directions       = DirectionsArray ?? new int[] { }
                };

                var json = JObject.FromObject(initObject);
                _socket = IO.Socket(_liveDataUrl);
                _socket.On(Socket.EVENT_CONNECT, () =>
                {
                    _socket.Emit(STROKE_INIT, json);
                    _socket.Emit(LOGS_INIT, "");
                    ShowBadge?.Invoke(this, new BadgeEventArgs(BadgeEventArgs.BadgeType.CONNECTED));
                    PushToLog(this,
                              new BlitzEventArgs("Kapcsolódva Socket.IO-hoz", "Socket.IO-hozzáférés",
                                                 BlitzEventArgs.EventMood.OK));
                });

                _socket.On(Socket.EVENT_ERROR, OnSocketIoError);
                _socket.On(Socket.EVENT_CONNECT_ERROR, OnSocketIoError);
                _socket.On(Socket.EVENT_CONNECT_TIMEOUT, OnSocketIoError);
                _socket.On(STROKES, OnReceiveSingleStroke);
                _socket.On(STROKE_INIT, OnReceiveMultipleStrokes);
                _socket.On(LOGS, OnReceiveLogs);
                _socket.On(LOGS_INIT, OnReceiveLogsInit);
                _socket.On(ALERTS, OnReceiveAlerts);
            }

            catch (Exception e)
            {
                PushToLog?.Invoke(this,
                                  new BlitzEventArgs("Kapcsolódás Socket.IO-hoz sikertelen", "Socket.IO-hozzáférés",
                                                     BlitzEventArgs.EventMood.ERR));
            }
        }
Пример #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            hash ^= unlockConditions_.GetHashCode();
            if (AssetScriptName.Length != 0)
            {
                hash ^= AssetScriptName.GetHashCode();
            }
            if (Icon.Length != 0)
            {
                hash ^= Icon.GetHashCode();
            }
            if (AssetType != 0)
            {
                hash ^= AssetType.GetHashCode();
            }
            if (LensType != 0)
            {
                hash ^= LensType.GetHashCode();
            }
            if (Visible != false)
            {
                hash ^= Visible.GetHashCode();
            }
            if (MediaSupportedType != 0)
            {
                hash ^= MediaSupportedType.GetHashCode();
            }
            if (Animated != false)
            {
                hash ^= Animated.GetHashCode();
            }
            if (StorePackId.Length != 0)
            {
                hash ^= StorePackId.GetHashCode();
            }
            if (OrderId != 0)
            {
                hash ^= OrderId.GetHashCode();
            }
            if (IsFullBodyLens != false)
            {
                hash ^= IsFullBodyLens.GetHashCode();
            }
            if (IsEmptyAsset != false)
            {
                hash ^= IsEmptyAsset.GetHashCode();
            }
            if (ShowBadge != false)
            {
                hash ^= ShowBadge.GetHashCode();
            }
            if (visibilityConditions_ != null)
            {
                hash ^= VisibilityConditions.GetHashCode();
            }
            if (StockAssetName.Length != 0)
            {
                hash ^= StockAssetName.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #4
0
        private void OnPropertyChanged(DependencyObject d, DependencyProperty prop)
        {
            if (prop == IsSelectedProperty)
            {
                // Toggle Selection indicator
                if (IsSelected)
                {
                    SelectIndicator.Fade(1, 200).Start();
                }
                else
                {
                    SelectIndicator.Fade(0, 200).Start();
                }
            }
            if (prop == IsUnreadProperty)
            {
                // Update unread indicator visibilty
                if (IsUnread && !IsMuted)
                {
                    UnreadIndicator.Visibility = Visibility.Visible;
                }
                else
                {
                    UnreadIndicator.Visibility = Visibility.Collapsed;
                }
            }
            if (prop == IsMutedProperty)
            {
                // Update muted icon
                if (IsMuted && Storage.Settings.ServerMuteIcons)
                {
                    MutedIcon.Visibility = Visibility.Visible;
                    ShowMute.Begin();
                }
                else
                {
                    HideMute.Begin();
                }

                // Override unread
                if (IsMuted)
                {
                    UnreadIndicator.Visibility = Visibility.Collapsed;
                }
                else if (IsUnread)
                {
                    UnreadIndicator.Visibility = Visibility.Visible;
                }
            }
            if (prop == NotificationCountProperty)
            {
                // Update notification visiblity
                if (NotificationCount > 0)
                {
                    NotificationCounter.Text = NotificationCount.ToString();
                    ShowBadge.Begin();
                    UnreadIndicator.Background = (SolidColorBrush)App.Current.Resources["Blurple"];
                    UnreadIndicator.Opacity    = 1;
                }
                else
                {
                    HideBadge.Begin();
                    UnreadIndicator.Background = (SolidColorBrush)App.Current.Resources["InvertedBG"];
                    UnreadIndicator.Opacity    = 0.75;
                }
            }
            if (prop == GuildNameProperty)
            {
                // Update Tooltip
                ToolTipService.SetToolTip(this, GuildName);
            }
            if (prop == ImageUrlProperty)
            {
                // Update Icon
                if (ImageUrl != "empty" && ImageUrl != "")
                {
                    GuildImageBrush.ImageSource = new BitmapImage(new Uri(ImageUrl));
                    TextIcon.Text       = "";
                    TextIcon.Visibility = Visibility.Collapsed;
                }
                else if (ImageUrl == "empty")
                {
                    GuildImageBrush.ImageSource = null;
                    if (GuildName != "")
                    {
                        TextIcon.Text = String.Join("", Regex.Matches(GuildName, @"(?<=^|[ \-_|+=~])\w")
                                                    .Cast <Match>()
                                                    .Select(m => m.Value)
                                                    .ToArray());
                        TextIcon.Visibility = Visibility.Visible;
                    }
                }
            }
            if (prop == IdProperty)
            {
                // Update DM Guild status
                if (Id != null && Id == "@me")
                {
                    DMView.Visibility             = Visibility.Visible;
                    GuildImageBackdrop.Visibility = Visibility.Collapsed;
                }
                else
                {
                    DMView.Visibility             = Visibility.Collapsed;
                    GuildImageBackdrop.Visibility = Visibility.Visible;
                }
            }
            if (prop == IsValidProperty)
            {
                // Update Invalid Guild Overlay
                InvalidOverlay.Visibility = IsValid ? Visibility.Collapsed : Visibility.Visible;
            }
        }
Пример #5
0
        private async void OnPropertyChanged(DependencyObject d, DependencyProperty prop)
        {
            if (prop == IsSelectedProperty)
            {
                if (Type == 2)
                {
                    // Because it's a Voice Channel the Voice Icon needs to be brighter too
                    if (IsSelected)
                    {
                        VoiceIcon.Fade(1, 200).Start();
                        SelectIndicator.Fade(0.4f, 200).Start();
                    }
                    else
                    {
                        VoiceIcon.Fade(0.4f, 200).Start();
                        SelectIndicator.Fade(0.4f, 200).Start();
                    }
                }
                else
                {
                    // Show Selected indicator if selected
                    if (IsSelected)
                    {
                        SelectIndicator.Fade(1, 200).Start();
                    }
                    else
                    {
                        SelectIndicator.Fade(0, 200).Start();
                    }
                }

                // Tie up loose ends
                UpdateOpacity();
                UpdateHidden();
            }
            if (prop == UserStatusProperty)
            {
                // Set the Presense icon
                if (UserStatus != null && UserStatus.Status != null && UserStatus.Status != "invisible")
                {
                    rectangle.Fill = (SolidColorBrush)App.Current.Resources[UserStatus.Status];
                }
                else
                {
                    rectangle.Fill = (SolidColorBrush)App.Current.Resources["offline"];
                }

                // Set the game status
                if (UserStatus != null && UserStatus.Game != null)
                {
                    // There's a game, show it
                    playing.Visibility = Visibility.Visible;
                    game.Visibility    = Visibility.Visible;

                    // Set name of the game
                    game.Text = UserStatus.Game.Name;

                    // Check if Rich Presence
                    if (UserStatus.Game.State != null || UserStatus.Game.Details != null || UserStatus.Game.SessionId != null)
                    {
                        game.Opacity    = 1;
                        rich.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        game.Opacity    = 0.4;
                        rich.Visibility = Visibility.Collapsed;
                    }

                    // Check type of rich-presense
                    switch (UserStatus.Game.Type)
                    {
                    case 0:
                        playing.Text = App.GetString("/Controls/Playing");
                        break;

                    case 1:
                        playing.Text = App.GetString("/Controls/Streaming");
                        break;

                    case 2:
                        playing.Text = App.GetString("/Controls/ListeningTo");
                        break;

                    case 3:
                        playing.Text = App.GetString("/Controls/Watching");
                        break;
                    }
                }
                else
                {
                    // There's no game, hide it all
                    playing.Visibility = Visibility.Collapsed;
                    rich.Visibility    = Visibility.Collapsed;
                    game.Visibility    = Visibility.Collapsed;
                }
            }
            if (prop == SubtitleProperty)
            {
                // Update Subtitle text
                if (Subtitle != "")
                {
                    SubTitle.Visibility = Visibility.Visible;
                    SubTitle.Text       = Subtitle;
                }
                else
                {
                    SubTitle.Visibility = Visibility.Collapsed;
                }
            }
            if (prop == IsUnreadProperty)
            {
                if (IsUnread && !IsMuted)
                {
                    // Show indicator
                    UnreadIndicator.Visibility = Visibility.Visible;
                }
                else
                {
                    // Hide indicator
                    UnreadIndicator.Visibility = Visibility.Collapsed;
                }

                // Tie up loose ends
                UpdateOpacity();
                UpdateHidden();
            }
            if (prop == HavePermissionProperty)
            {
                if (HavePermission)
                {
                    // Enable the channel if it can be entered
                    IsEnabled = true;
                    UpdateOpacity();
                }
                else
                {
                    // Disable the channel if it can't be entered
                    IsEnabled = false;
                    UpdateOpacity();
                }
            }
            if (prop == IsMutedProperty)
            {
                if (IsMuted)
                {
                    // Show muted icon
                    MuteIcon.Visibility = Visibility.Visible;

                    // Hide unread
                    UnreadIndicator.Visibility = Visibility.Collapsed;
                }
                else
                {
                    // Hide muted icon
                    MuteIcon.Visibility = Visibility.Collapsed;

                    // Show unread
                    if (IsUnread)
                    {
                        UnreadIndicator.Visibility = Visibility.Visible;
                    }
                }

                // Tie up loose ends
                UpdateOpacity();
                UpdateHidden();
            }
            if (prop == IsTypingProperty)
            {
                if (IsTyping && !IsMuted)
                {
                    // Show typing indicator
                    TypingIndic.Visibility = Visibility.Visible;
                    TypingIndic.Fade(1, 200).Start();
                }
                else
                {
                    // Hide typing indicator
                    await TypingIndic.Fade(0, 200).StartAsync();

                    TypingIndic.Visibility = Visibility.Collapsed;
                }
            }
            if (prop == NotificationCountProperty)
            {
                if (NotificationCount > 0)
                {
                    // Show Notification text
                    NotificationCounter.Text = NotificationCount.ToString();
                    ShowBadge.Begin();
                }
                else
                {
                    // Hide Notification text
                    HideBadge.Begin();
                }

                //Tie up loose ends
                UpdateHidden();
            }
            if (prop == ChnNameProperty)
            {
                // Update Channel Name
                ChannelName.Text = CName;
            }
            if (prop == ImageUrlProperty)
            {
                if (ImageUrl != "")
                {
                    // Update Image Source
                    ChannelImageBrush.ImageSource = new BitmapImage(new Uri(ImageUrl));
                }
            }
            if (prop == TypeProperty)
            {
                // Reset
                ChannelName.FontWeight = FontWeights.Normal;
                ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["Foreground"];
                Chevron.Visibility     = Visibility.Collapsed;
                HoverCache.Visibility  = Visibility.Collapsed;

                this.Margin = new Thickness(0);

                //TEXT
                if (Type == 0)
                {
                    HashtagIcon.Visibility          = Visibility.Visible;
                    VoiceIcon.Visibility            = Visibility.Collapsed;
                    MemberList.Visibility           = Visibility.Collapsed;
                    ChannelImage.Visibility         = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility = Visibility.Collapsed;
                    rectangle.Visibility            = Visibility.Collapsed;
                    grid.Height = Double.NaN;
                }

                //VOICE
                else if (Type == 2)
                {
                    HashtagIcon.Visibility          = Visibility.Collapsed;
                    ChannelImage.Visibility         = Visibility.Collapsed;
                    VoiceIcon.Visibility            = Visibility.Visible;
                    Chevron.Visibility              = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility = Visibility.Collapsed;
                    rectangle.Visibility            = Visibility.Collapsed;
                    VoiceMembers = new Dictionary <string, VoiceMemberContainer>();
                    grid.Height  = Double.NaN;

                    // Subscribe to event of VoiceState changing
                    GatewayManager.Gateway.VoiceStateUpdated += Gateway_VoiceStateUpdated;

                    // Add users to list of voice members
                    foreach (var user in LocalState.VoiceDict.Values)
                    {
                        if (user.ChannelId == Id)
                        {
                            VoiceMembers.Add(user.UserId, new VoiceMemberContainer()
                            {
                                VoiceState = LocalState.VoiceDict[user.UserId]
                            });
                        }
                    }

                    // Add Voice Members to display
                    if (VoiceMembers != null && VoiceMembers.Count > 0)
                    {
                        MemberList.Visibility = Visibility.Visible;
                        foreach (VoiceMemberContainer member in VoiceMembers.Values)
                        {
                            if (LocalState.Guilds[App.CurrentGuildId].members.ContainsKey(member.VoiceState.UserId))
                            {
                                MemberList.Items.Add(member);
                            }
                        }
                    }
                    else
                    {
                        MemberList.Visibility = Visibility.Collapsed;
                    }
                }

                //DM
                else if (Type == 1)
                {
                    HashtagIcon.Visibility          = Visibility.Collapsed;
                    VoiceIcon.Visibility            = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility =
                        LocalState.DMs[Id].Users.FirstOrDefault().Avatar == null ?
                        Visibility.Visible : Visibility.Collapsed;
                    ChannelImage.Visibility       = Visibility.Visible;
                    rectangle.Visibility          = Visibility.Visible;
                    Chevron.Visibility            = Visibility.Collapsed;
                    rectangle.Visibility          = Visibility.Visible;
                    grid.Height                   = 48;
                    ChannelImage.Margin           = new Thickness(0, 6, 6, 6);
                    ChannelImageBackdrop.Fill     = Common.DiscriminatorColor(LocalState.DMs[Id].Users.FirstOrDefault().Discriminator);
                    ChannelImageBrush.ImageSource = new BitmapImage(Common.AvatarUri(LocalState.DMs[Id].Users.FirstOrDefault().Avatar, LocalState.DMs[Id].Users.FirstOrDefault().Id, "?size=64"));
                    MemberList.Visibility         = Visibility.Collapsed;
                }

                //GROUP DM
                else if (Type == 3)
                {
                    HashtagIcon.Visibility          = Visibility.Collapsed;
                    VoiceIcon.Visibility            = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility = Visibility.Collapsed;
                    ChannelImage.Visibility         = Visibility.Visible;
                    rectangle.Visibility            = Visibility.Collapsed;
                    Chevron.Visibility = Visibility.Collapsed;
                    grid.Height        = 48;

                    // Set icon (if null)
                    if (string.IsNullOrEmpty(Icon))
                    {
                        if (App.Current.RequestedTheme == ApplicationTheme.Dark)
                        {
                            ChannelImageBrush.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/DiscordAssets/Friends_dark.png"));
                        }
                        else
                        {
                            ChannelImageBrush.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/DiscordAssets/Friends_light.png"));
                        }
                    }

                    ChannelImage.Margin   = new Thickness(0, 6, 6, 6);
                    MemberList.Visibility = Visibility.Collapsed;
                }

                //CHANNEL CATEGORY
                else if (Type == 4)
                {
                    HashtagIcon.Visibility          = Visibility.Collapsed;
                    VoiceIcon.Visibility            = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility = Visibility.Collapsed;
                    ChannelImage.Visibility         = Visibility.Collapsed;
                    rectangle.Visibility            = Visibility.Collapsed;
                    ChannelName.FontWeight          = FontWeights.Light;
                    ChannelName.Foreground          = (SolidColorBrush)App.Current.Resources["Blurple"];
                    Chevron.Visibility    = Visibility.Visible;
                    HoverCache.Visibility = Visibility.Visible;
                    this.Margin           = new Thickness(0, 18, 0, 0);
                    MemberList.Visibility = Visibility.Collapsed;
                    grid.Height           = Double.NaN;
                }

                // Tie up loose ends
                UpdateOpacity();

                // Clear Voice Update event if applicable
                if (Type != 2)
                {
                    GatewayManager.Gateway.VoiceStateUpdated -= Gateway_VoiceStateUpdated;
                }
            }
            if (prop == IsHiddenProperty)
            {
                UpdateHidden();
            }
            if (prop == NSFWProperty)
            {
                if (NSFW)
                {
                    HashtagIcon.Foreground = ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["dnd"];
                }
                else
                {
                    HashtagIcon.Foreground = ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["Foreground"];
                }
            }
            if (prop == IconProperty)
            {
                if (!string.IsNullOrEmpty(Icon))
                {
                    ChannelImageBrush.ImageSource = new BitmapImage(new Uri("https://cdn.discordapp.com/channel-icons/" + Id + "/" + Icon + ".png"));
                }
            }
        }
Пример #6
0
        private async void OnPropertyChanged(DependencyObject d, DependencyProperty prop)
        {
            //if (!App.CurrentGuildIsDM && Id != "")
            //{
            //    if (!Storage.Cache.Guilds[App.CurrentGuildId].Channels[Id].chnPerms.EffectivePerms.Administrator && !Storage.Cache.Guilds[App.CurrentGuildId].Channels[Id].chnPerms.EffectivePerms.ReadMessages)
            //    {
            //        this.Visibility = Visibility.Collapsed;
            //    }
            //}

            if (prop == IsSelectedProperty)
            {
                if (Type == 2)
                {
                    if (IsSelected)
                    {
                        ChannelName.Fade(1, 200).Start();
                        VoiceIcon.Fade(1, 200).Start();
                        SelectIndicator.Fade(0.6f, 200).Start();
                    }
                    else
                    {
                        ChannelName.Fade(0.6f, 200).Start();
                        VoiceIcon.Fade(0.6f, 200).Start();
                        SelectIndicator.Fade(0.6f, 200).Start();
                    }
                }
                else
                {
                    if (IsSelected)
                    {
                        SelectIndicator.Fade(1, 200).Start();
                    }
                    else
                    {
                        SelectIndicator.Fade(0, 200).Start();
                    }
                }
                UpdateHidden();
            }

            if (prop == UserStatusProperty)
            {
                if (UserStatus != "" && UserStatus != null)
                {
                    Status.Fill = (SolidColorBrush)App.Current.Resources[UserStatus];
                }
            }
            if (prop == SubtitleProperty)
            {
                if (Subtitle != "")
                {
                    SubTitle.Visibility = Visibility.Visible;
                    SubTitle.Text       = Subtitle;
                }
                else
                {
                    SubTitle.Visibility = Visibility.Collapsed;
                }
            }
            if (prop == PlayingProperty)
            {
                if (Playing.HasValue)
                {
                    PlayingBlock.Visibility = Visibility.Visible;
                    switch (Playing.Value.Type)
                    {
                    case 0:
                        PlayingType.Text = App.GetString("/Controls/Playing");
                        break;

                    case 1:
                        PlayingType.Text = App.GetString("/Controls/Streaming");
                        break;
                    }
                    PlayingText.Text = Playing.Value.Name;
                }
                else
                {
                    PlayingBlock.Visibility = Visibility.Collapsed;
                }
            }

            if (prop == IsUnreadProperty)
            {
                if (IsUnread && !IsMuted)
                {
                    ChannelName.Fade(1, 200).Start();
                    UnreadIndicator.Visibility = Visibility.Visible;
                    if (IsHidden)
                    {
                        //await this.Fade(0, 200, 0).StartAsync();
                        this.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    ChannelName.Fade(0.6f, 200).Start();
                    UnreadIndicator.Visibility = Visibility.Collapsed;
                    if (IsHidden)
                    {
                        this.Visibility = Visibility.Visible;
                        this.Fade(1, 200, 0).Start();
                    }
                }
                UpdateHidden();
            }
            if (prop == IsMutedProperty)
            {
                if (IsMuted)
                {
                    ChannelName.Opacity = 0.5;
                    MuteIcon.Visibility = Visibility.Visible;
                    ChannelName.Fade(0.75f, 200).Start();
                    UnreadIndicator.Visibility = Visibility.Collapsed;
                }
                else
                {
                    MuteIcon.Visibility = Visibility.Collapsed;
                }
                UpdateHidden();
            }
            if (prop == IsTypingProperty)
            {
                if (IsTyping)
                {
                    TypingIndic.Visibility = Visibility.Visible;
                    TypingIndic.Fade(1, 200).Start();
                }
                else
                {
                    await TypingIndic.Fade(0, 200).StartAsync();

                    TypingIndic.Visibility = Visibility.Collapsed;
                }
            }
            if (prop == NotificationCountProperty)
            {
                if (NotificationCount > 0)
                {
                    NotificationCounter.Text = NotificationCount.ToString();
                    ShowBadge.Begin();
                }
                else
                {
                    HideBadge.Begin();
                }
                UpdateHidden();
            }
            if (prop == ChnNameProperty)
            {
                ChannelName.Text = CName;
            }
            if (prop == ImageUrlProperty)
            {
                if (ImageUrl != "")
                {
                    ChannelImageBrush.ImageSource = new BitmapImage(new Uri(ImageUrl));
                }
            }
            if (prop == TypeProperty)
            {
                ChannelName.FontWeight = FontWeights.Normal;
                ChannelName.Opacity    = 0.75;
                ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["Foreground"];
                Chevron.Visibility     = Visibility.Collapsed;
                HoverCache.Visibility  = Visibility.Collapsed;

                this.Margin = new Thickness(0);

                if (Type == 0)
                {
                    //TEXT
                    HashtagIcon.Visibility = Visibility.Visible;
                    VoiceIcon.Visibility   = Visibility.Collapsed;
                    MemberList.Visibility  = Visibility.Collapsed;
                    Tapped -= JoinVoiceChannel;
                }
                else if (Type == 2)
                {
                    //VOICE
                    HashtagIcon.Visibility = Visibility.Collapsed;
                    VoiceIcon.Visibility   = Visibility.Visible;

                    VoiceMembers = new Dictionary <string, VoiceMemberContainer>();

                    GatewayManager.Gateway.VoiceStateUpdated += Gateway_VoiceStateUpdated;

                    foreach (var user in LocalState.VoiceDict.Values)
                    {
                        if (user.ChannelId == Id)
                        {
                            VoiceMembers.Add(user.UserId, new VoiceMemberContainer()
                            {
                                VoiceState = LocalState.VoiceDict[user.UserId]
                            });
                        }
                    }

                    if (VoiceMembers != null)
                    {
                        foreach (VoiceMemberContainer member in VoiceMembers.Values)
                        {
                            if (LocalState.Guilds[App.CurrentGuildId].members.ContainsKey(member.VoiceState.UserId))
                            {
                                MemberList.Items.Add(member);
                            }
                        }
                        //Debug MemberList.Items.Add(new VoiceMemberControl.SimpleMember() { Member = Storage.Cache.Guilds[App.CurrentGuildId].Members[Storage.Cache.CurrentUser.Raw.Id] });
                    }

                    Tapped += JoinVoiceChannel;
                }
                else if (Type == 1)
                {
                    //DM
                    HashtagIcon.Visibility = Visibility.Collapsed;
                    if (LocalState.DMs[Id].Users.FirstOrDefault().Avatar == null)
                    {
                        ChannelImageBackdrop.Visibility = Visibility.Visible;
                    }
                    ChannelImage.Visibility       = Visibility.Visible;
                    Status.Visibility             = Visibility.Visible;
                    grid.Height                   = 48;
                    ChannelImage.Margin           = new Thickness(0, 6, 6, 6);
                    ChannelImageBackdrop.Fill     = Common.DiscriminatorColor(LocalState.DMs[Id].Users.FirstOrDefault().Discriminator);
                    ChannelImageBrush.ImageSource = new BitmapImage(Common.AvatarUri(LocalState.DMs[Id].Users.FirstOrDefault().Avatar, LocalState.DMs[Id].Users.FirstOrDefault().Id, "?size=64"));
                    MemberList.Visibility         = Visibility.Collapsed;
                    Tapped -= JoinVoiceChannel;
                }
                else if (Type == 3)
                {
                    //GROUP DM
                    HashtagIcon.Visibility          = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility = Visibility.Visible;
                    ChannelImage.Visibility         = Visibility.Visible;
                    Status.Visibility = Visibility.Collapsed;
                    grid.Height       = 48;
                    //ChannelImageBrush.ImageSource = new SvgImageSource(new Uri("ms-appx:///Assets/DiscordAssets/groupchat.svg"));

                    if (App.Current.RequestedTheme == ApplicationTheme.Dark)
                    {
                        ChannelImageBrush.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/DiscordAssets/Friends_dark.png"));
                    }
                    else
                    {
                        ChannelImageBrush.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/DiscordAssets/Friends_light.png"));
                    }

                    ChannelImage.Margin   = new Thickness(0, 6, 6, 6);
                    MemberList.Visibility = Visibility.Collapsed;
                    Tapped -= JoinVoiceChannel;
                }
                else if (Type == 4)
                {
                    //CHANNEL CATEGORY
                    HashtagIcon.Visibility          = Visibility.Collapsed;
                    VoiceIcon.Visibility            = Visibility.Collapsed;
                    ChannelImageBackdrop.Visibility = Visibility.Collapsed;
                    ChannelImage.Visibility         = Visibility.Collapsed;
                    Status.Visibility      = Visibility.Collapsed;
                    ChannelName.FontWeight = FontWeights.Light;
                    ChannelName.Opacity    = 1;
                    ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["Blurple"];
                    Chevron.Visibility     = Visibility.Visible;
                    HoverCache.Visibility  = Visibility.Visible;
                    this.Margin            = new Thickness(0, 18, 0, 0);
                    MemberList.Visibility  = Visibility.Collapsed;
                    Tapped -= JoinVoiceChannel;
                }

                if (Type != 2)
                {
                    GatewayManager.Gateway.VoiceStateUpdated -= Gateway_VoiceStateUpdated;
                }
            }
            if (prop == IsHiddenProperty)
            {
                UpdateHidden();
            }
            if (prop == NSFWProperty)
            {
                if (NSFW)
                {
                    HashtagIcon.Foreground = ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["dnd"];
                }
                else
                {
                    HashtagIcon.Foreground = ChannelName.Foreground = (SolidColorBrush)App.Current.Resources["Foreground"];
                }
            }
        }
Пример #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Priority != 0)
            {
                hash ^= Priority.GetHashCode();
            }
            if (SubcategoryId.Length != 0)
            {
                hash ^= SubcategoryId.GetHashCode();
            }
            if (IconPath.Length != 0)
            {
                hash ^= IconPath.GetHashCode();
            }
            if (ShowQuantityBanner != false)
            {
                hash ^= ShowQuantityBanner.GetHashCode();
            }
            if (QuantityOverride.Length != 0)
            {
                hash ^= QuantityOverride.GetHashCode();
            }
            if (PrefabPath.Length != 0)
            {
                hash ^= PrefabPath.GetHashCode();
            }
            if (MarketingText.Length != 0)
            {
                hash ^= MarketingText.GetHashCode();
            }
            if (DescriptionText.Length != 0)
            {
                hash ^= DescriptionText.GetHashCode();
            }
            if (ShowBadge != false)
            {
                hash ^= ShowBadge.GetHashCode();
            }
            if (BonusValue != 0)
            {
                hash ^= BonusValue.GetHashCode();
            }
            if (RarityId.Length != 0)
            {
                hash ^= RarityId.GetHashCode();
            }
            if (PackSize != 0)
            {
                hash ^= PackSize.GetHashCode();
            }
            if (ShowInHud != false)
            {
                hash ^= ShowInHud.GetHashCode();
            }
            if (HudPriority != 0)
            {
                hash ^= HudPriority.GetHashCode();
            }
            if (HudIconPath.Length != 0)
            {
                hash ^= HudIconPath.GetHashCode();
            }
            if (Icon2Path.Length != 0)
            {
                hash ^= Icon2Path.GetHashCode();
            }
            if (PopupImageOverride.Length != 0)
            {
                hash ^= PopupImageOverride.GetHashCode();
            }
            if (HidePackOnSoldOut != false)
            {
                hash ^= HidePackOnSoldOut.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #8
0
 private void OnSocketIoError(object obj)
 {
     ShowBadge?.Invoke(this, new BadgeEventArgs(BadgeEventArgs.BadgeType.CONNECTION_ERROR));
     PushToLog?.Invoke(this,
                       new BlitzEventArgs("Socket.IO kapcsolati hiba", "Socket.IO-hozzáférés", BlitzEventArgs.EventMood.ERR));
 }