Ejemplo n.º 1
0
        private void OnClick(object sender, RoutedEventArgs e)
        {
            if (With is TLChannel channel)
            {
                if (channel.IsLeft)
                {
                    JoinCommand?.Execute(null);
                }
                else if (channel.HasBannedRights && channel.BannedRights.IsViewMessages)
                {
                    DeleteAndExitCommand?.Execute(null);
                }
                else
                {
                    if (channel.IsBroadcast)
                    {
                        if (channel.IsCreator || (channel.HasAdminRights && channel.AdminRights.IsPostMessages))
                        {
                        }
                        else
                        {
                            ToggleMuteCommand?.Execute(null);
                        }
                    }
                }
            }

            if (With is TLChatForbidden forbiddenChat)
            {
                DeleteAndExitCommand?.Execute(null);
            }

            if (With is TLUser user)
            {
                var full = InMemoryCacheService.Current.GetFullUser(user.Id);
                if (full != null && full.IsBlocked)
                {
                    UnblockCommand?.Execute(null);
                }

                if (user.IsBot && HasAccessToken)
                {
                    StartCommand?.Execute(null);
                }

                if (user.IsDeleted)
                {
                    DeleteAndExitCommand?.Execute(null);
                }
            }
        }
Ejemplo n.º 2
0
        private void ConfigureHotkeys(Configuration config)
        {
            ToggleMuteCommand cmd = new ToggleMuteCommand(MuteToggleButton_Click);
            Key          key      = Key.J;
            ModifierKeys modKey   = ModifierKeys.Alt;

            if (!string.IsNullOrEmpty(config.Key?.Key))
            {
                Enum.TryParse(config.Key?.Key, out key);
            }

            if (!string.IsNullOrEmpty(config.ModifierKey?.Key))
            {
                Enum.TryParse(config.ModifierKey?.Key, out modKey);
            }

            globalKey = new KeyBinding(cmd, key, modKey);
            NHotkey.Wpf.HotkeyManager.SetRegisterGlobalHotkey(globalKey, true);
        }
Ejemplo n.º 3
0
 public Task ToggleMuteFromMediaWebSocket()
 {
     return(ToggleMuteCommand.ExecuteAsync());
 }