Esempio n. 1
0
 private async void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     await this.RunAsyncOperation(async() =>
     {
         Button button            = (Button)sender;
         ChannelHostModel channel = (ChannelHostModel)button.DataContext;
         await this.viewModel.DeleteChannel(channel);
     });
 }
Esempio n. 2
0
 private async void EnableDisableToggleButton_Checked(object sender, RoutedEventArgs e)
 {
     await this.RunAsyncOperation(async() =>
     {
         ToggleButton button      = (ToggleButton)sender;
         ChannelHostModel channel = (ChannelHostModel)button.DataContext;
         channel.IsEnabled        = button.IsChecked.GetValueOrDefault();
         await this.viewModel.SaveData();
     });
 }
        public async Task MoveChannelDown(ChannelHostModel channel)
        {
            int index = this.Channels.IndexOf(channel) + 1;

            if (index < this.Channels.Count)
            {
                this.Channels.Remove(channel);
                this.Channels.Insert(index, channel);
                await this.SaveData();
            }
        }
        public async Task MoveChannelUp(ChannelHostModel channel)
        {
            int index = this.Channels.IndexOf(channel) - 1;

            if (index >= 0)
            {
                this.Channels.Remove(channel);
                this.Channels.Insert(index, channel);
                await this.SaveData();
            }
        }
        private async Task <ChannelModel> UpdateChannel(ChannelHostModel channel)
        {
            UserWithChannelModel channelModel = await this.connection.Users.GetUser(channel.ID);

            if (channelModel != null)
            {
                channel.ID       = channel.ID;
                channel.Name     = channelModel.username;
                channel.IsOnline = channelModel.channel.online;
            }
            else
            {
                channel.IsOnline = false;
            }
            return(channelModel.channel);
        }
 public async Task EnableDisableChannel(ChannelHostModel channel)
 {
     channel.IsEnabled = !channel.IsEnabled;
     await this.SaveData();
 }
 public async Task DeleteChannel(ChannelHostModel channel)
 {
     this.Channels.Remove(channel);
     await this.SaveData();
 }