Esempio n. 1
0
        /// <summary>
        /// 更改播放歌曲入口函数
        /// </summary>
        /// <param name="playingSongId"></param>
        /// <param name="songsItems"></param>
        /// <param name="songsItem"></param>
        /// <returns></returns>
        public static async Task <bool> ChangePlayingSong(long playingSongId, List <SongsItem> songsItems, SongsItem songsItem = null)
        {
            IsPlayingSong   = true;
            PlayingSongId   = playingSongId;
            PlayingSongList = songsItems;
            bool b;

            if (songsItem == null)
            {
                b = await PreparePlayingSong(PlayingSongId);
            }
            else
            {
                b = await PreparePlayingSong(PlayingSongId, songsItem);
            }
            if (!b)
            {
                NotifyPopup notifyPopup = new NotifyPopup("获取音乐失败");
                notifyPopup.Show();
            }
            else
            {
                PlayingListToBaseObject(PlayingSongList);
                WhenPlayingSongChange();
            }
            return(b);
        }
Esempio n. 2
0
 private async void Button_sub_Click(object sender, RoutedEventArgs e)
 {
     if (playListDetailRoot.playlist.subscribed == "true")
     {
         if (await Task.Run(() => PlaylistService.SubOrCancelPlayList(playListDetailRoot.playlist.id, 2)))
         {
             NotifyPopup notifyPopup = new NotifyPopup("已取消收藏", "\xE224", Colors.MediumSeaGreen);
             notifyPopup.Show();
             TextBlock_subIcon.Text   = "\xECCD";
             TextBlock_subscribe.Text = "收藏";
         }
         else
         {
             NotifyPopup notifyPopup = new NotifyPopup("操作失败", "\xE171");
             notifyPopup.Show();
         }
     }
     else
     {
         if (await Task.Run(() => PlaylistService.SubOrCancelPlayList(playListDetailRoot.playlist.id, 1)))
         {
             NotifyPopup notifyPopup = new NotifyPopup("已添加收藏", "\xE082", Colors.MediumSeaGreen);
             notifyPopup.Show();
             TextBlock_subIcon.Text   = "\xF89A";
             TextBlock_subscribe.Text = "已收藏";
         }
         else
         {
             NotifyPopup notifyPopup = new NotifyPopup("操作失败", "\xE171");
             notifyPopup.Show();
         }
     }
 }
        public async void GetTopicArticles(int topicid)
        {
            var vault          = new Windows.Security.Credentials.PasswordVault();
            var credentialList = vault.FindAllByResource(resourceName);

            credentialList[0].RetrievePassword();
            if (credentialList[0] != null)
            {
                try
                {
                    List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >();
                    paramList.Add(new KeyValuePair <string, string>("stuNum", credentialList[0].UserName));
                    paramList.Add(new KeyValuePair <string, string>("topic_id", topicid.ToString()));
                    string Topictemp = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/Topic/listTopicArticle", paramList);

                    JObject Tobj = JObject.Parse(Topictemp);
                    if (Int32.Parse(Tobj["status"].ToString()) == 200)
                    {
                        string       content = Tobj["data"].ToString();
                        JObject      _tobj   = JObject.Parse(content);
                        TopicContent item    = new TopicContent();
                        item.GetAttribute(_tobj);
                        foreach (var _item in item.articles)
                        {
                            al.Add(_item);
                        }
                    }
                }
                catch
                {
                    NotifyPopup notifyPopup = new NotifyPopup("网络异常 无法读取话题详情~");
                    notifyPopup.Show();
                }
            }
        }
Esempio n. 4
0
        public IActionResult Edit(int id, NotifyPopup notifyPopup)
        {
            if (id != notifyPopup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _notifyPopupRepository.UpdateNotifyPopup(notifyPopup);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_notifyPopupRepository.NotifyPopupExists(notifyPopup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(notifyPopup));
        }
Esempio n. 5
0
        //确认选择
        private void FeedSelect_Confirm(object sender, RoutedEventArgs e)
        {
            UserDB.UpdateSubscription(allSource);
            NotifyPopup notifyPopup = new NotifyPopup("订阅成功!");

            notifyPopup.Show();
        }
Esempio n. 6
0
        private async void MyMusicList_Loaded(object sender, RoutedEventArgs e)
        {
            if (playlistItems_created == null && playlistItems_subscribed == null)
            {
                playlistItems_created    = new ObservableCollection <PlaylistItem>();
                playlistItems_subscribed = new ObservableCollection <PlaylistItem>();
                MyPlaylistRoot myPlaylistRoot = await Task.Run(() => PlaylistService.GetMyPlaylist());

                if (myPlaylistRoot == null || myPlaylistRoot.playlist == null)
                {
                    NotifyPopup notifyPopup = new NotifyPopup("获取失败");
                    notifyPopup.Show();
                    return;
                }
                foreach (var temp in myPlaylistRoot.playlist)
                {
                    if (temp.subscribed == "true")
                    {
                        playlistItems_subscribed.Add(temp);
                    }
                    else
                    {
                        playlistItems_created.Add(temp);
                    }
                }
                myPlaylistRoot = null;
            }
            AdaptiveGridView_createdByMe.ItemsSource = playlistItems_created;
            AdaptiveGridView_subscribed.ItemsSource  = playlistItems_subscribed;
        }
Esempio n. 7
0
        //开始和停止按钮点击方法
        private void Calculation_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.ExperienceName.Text))
            {
                NotifyPopup notifyPopup = new NotifyPopup("Experience Name cannot be empty.");
                notifyPopup.Show();
                return;
            }
            if (string.IsNullOrWhiteSpace(this.SamplingTimeText.Text))
            {
                NotifyPopup notifyPopup = new NotifyPopup("Sampling Time cannot be empty.");
                notifyPopup.Show();
                return;
            }
            //SamplingTimeText WaitTimeText HighestTempText
            //    HighHoldingTimeText LowHoldingTimeText RampSpeedText

            //    BeginTimeText1 EndTimeText1
            if (ClickCalculationStatus == 0)
            {
                CalcButtonImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/stop-button.png"));
                CalcTestText.Text      = "STOP";
                ClickCalculationStatus = 1;
                StartCountDown();
            }
            else
            {
                CalcButtonImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/start-button.png"));
                CalcTestText.Text      = "START";
                ClickCalculationStatus = 0;
                timer.Stop();
                c.Update(0, 1000);
                Value = 0;
            }
        }
Esempio n. 8
0
        //删除磁贴,在删除便签是调用
        public async static void DeleteTile(int id)
        {
            string tileId   = id.ToString();
            var    tempList = await SecondaryTile.FindAllAsync();

            var tilelist = tempList.ToList();

            if (SecondaryTile.Exists(tileId)) //存在
            {
                for (int i = 0; i < tilelist.Count; i++)
                {
                    if (tilelist[i].TileId == tileId)
                    {
                        await tilelist[i].RequestDeleteAsync();
                        var   notifyPopup = new NotifyPopup("已删除该磁贴");
                        notifyPopup.Show();
                        break;
                    }
                }
            }
            //else
            //{
            //    var notifyPopup = new NotifyPopup("不存在该磁贴");
            //    notifyPopup.Show();
            //}
        }
Esempio n. 9
0
 private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     SearchTopicList.Clear();
     if (searchBox.Text != "")
     {
         string temp = searchBox.Text;
         foreach (var item in TopicList)
         {
             if (item.keyword.Contains(temp))
             {
                 SearchTopicList.Add(item);
             }
         }
         if (SearchTopicList.Count == 0)
         {
             NotifyPopup notifyPopup = new NotifyPopup("没有找到该话题~");
             notifyPopup.Show();
         }
         else
         {
             pivotGrid.Visibility       = Visibility.Collapsed;
             SearchTopicGrid.Visibility = Visibility.Visible;
         }
     }
 }
        private async void DownloadAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            if (PhotosFlipView.SelectedItem is Post.Image)
            {
                string path     = (PhotosFlipView.SelectedItem as Post.Image).Url;
                string fileName = path.Substring(path.LastIndexOf('/') + 1);
                Image  image    = null;

                if (dictionary.ContainsKey(path))
                {
                    image = dictionary[path];

                    NotifyPopup notifyPopup = new NotifyPopup("开始下载图片...");
                    notifyPopup.Show();

                    await FileHelper.SaveImageAsync(image, appName, folderName, fileName, async() =>
                    {
                        await notifyPopup.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                        {
                            notifyPopup.Visibility = Visibility.Collapsed;

                            notifyPopup = new NotifyPopup("下载完成!");
                            notifyPopup.Show();
                        });
                    });
                }
            }
        }
Esempio n. 11
0
 public IActionResult Create(NotifyPopup notifyPopup)
 {
     if (ModelState.IsValid)
     {
         _notifyPopupRepository.AddNotifyPopup(notifyPopup);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(notifyPopup));
 }
Esempio n. 12
0
        //用户退出
        private void LogoutButton_Click(object sender, RoutedEventArgs e)
        {
            Services.UserService.UpdateProfile(UserDB.GetUser());
            Services.UserDatabase.SetUser("");
            NotifyPopup notifyPopup = new NotifyPopup("退出成功");

            notifyPopup.Show();
            Frame.Navigate(typeof(Login));
        }
        /// <summary>
        /// 取消时间提醒的popup
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToastCancelButton_Click(object sender, RoutedEventArgs e)
        {
            //var noteViewModel = Application.Current.Resources["NoteViewModel"] as NoteViewModel;
            var note = (DataContext as NoteViewModel)?.SelectNote;

            (Application.Current.Resources["NoteViewModel"] as NoteViewModel)?.CancelNotificationCommand.Execute(note);
            var notifyPopup = new NotifyPopup("当前时间提醒已取消");

            notifyPopup.Show();
        }
Esempio n. 14
0
        private async void WiteJsonFile(string json)
        {
            Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            Windows.Storage.StorageFile   file          = await storageFolder.CreateFileAsync(fileName, CreationCollisionOption.OpenIfExists);

            await FileIO.WriteTextAsync(file, json);

            NotifyPopup notifyPopup = new NotifyPopup(loader.GetString("UserSaveSuccess"));

            notifyPopup.Show();
        }
 private void CheckDownloadFinish()
 {
     lock (lockObject)
     {
         if (downloadCount < listCount)
         {
             downloadCount++;
             NotifyPopup notifyPopup = new NotifyPopup("下载完成!");
             notifyPopup.Show();
         }
     }
 }
Esempio n. 16
0
 private void Button_Radio_Click(object sender, RoutedEventArgs e)
 {
     if (ConfigService.Uid >= 0)
     {
         Frame_main.Navigate(typeof(Radio));
     }
     else
     {
         NotifyPopup notifyPopup = new NotifyPopup("请先登录");
         notifyPopup.Show();
     }
 }
Esempio n. 17
0
        public void OpenNotificationPopup(NotificationViewModel vm)
        {
            var window = new NotifyPopup
            {
                DataContext = vm,
                Top         = vm.WindowRect.Top,
                Left        = vm.WindowRect.Left
            };

            vm.Reset();
            window.Show();
        }
 public void AddNotifyPopup(NotifyPopup notifyPopup)
 {
     _appDbContext.NotifyPopups.Add(notifyPopup);
     if (notifyPopup.IsActive)
     {
         var notifyPopups = _appDbContext.NotifyPopups.Where(s => s.Id != notifyPopup.Id);
         foreach (var n in notifyPopups)
         {
             n.IsActive = false;
         }
     }
     _appDbContext.SaveChanges();
 }
Esempio n. 19
0
        private async void ExportPdfFile()
        {
            FileSavePicker savePicker = new FileSavePicker();

            savePicker.DefaultFileExtension = ".pdf";
            savePicker.SuggestedFileName    = pdfFileName;
            savePicker.FileTypeChoices.Add("Adobe PDF Document", new List <string>()
            {
                ".pdf"
            });
            StorageFile stFile = await savePicker.PickSaveFileAsync();

            StorageFolder applicationFolder = ApplicationData.Current.LocalFolder;
            StorageFolder methodFolder;

            if (ClickStatus == 0)
            {
                methodFolder = await applicationFolder.CreateFolderAsync("runTest",
                                                                         CreationCollisionOption.OpenIfExists);
            }
            else
            {
                methodFolder = await applicationFolder.CreateFolderAsync("calibrate",
                                                                         CreationCollisionOption.OpenIfExists);
            }
            StorageFolder pdfFolder = await methodFolder.CreateFolderAsync(pdfFolderName,
                                                                           CreationCollisionOption.OpenIfExists);

            StorageFile pdfFile = await pdfFolder.GetFileAsync(pdfFileName);

            byte[] buffer;
            Stream stream = await pdfFile.OpenStreamForReadAsync();

            buffer = new byte[stream.Length];
            await stream.ReadAsync(buffer, 0, (int)stream.Length);

            if (stFile != null)
            {
                CachedFileManager.DeferUpdates(stFile);
                await FileIO.WriteBytesAsync(stFile, buffer);

                Windows.Storage.Provider.FileUpdateStatus status =
                    await Windows.Storage.CachedFileManager.CompleteUpdatesAsync(stFile);

                if (status == Windows.Storage.Provider.FileUpdateStatus.Complete)
                {
                    NotifyPopup notifyPopup = new NotifyPopup(loader.GetString("SaveSuccess"));
                    notifyPopup.Show();
                }
            }
        }
 public void UpdateNotifyPopup(NotifyPopup notifyPopup)
 {
     _appDbContext.Entry(notifyPopup).State = EntityState.Modified;
     _appDbContext.Update(notifyPopup);
     if (notifyPopup.IsActive)
     {
         var notifyPopups = _appDbContext.NotifyPopups.Where(s => s.Id != notifyPopup.Id);
         foreach (var n in notifyPopups)
         {
             n.IsActive = false;
         }
     }
     _appDbContext.SaveChanges();
 }
Esempio n. 21
0
        private async void GetBaseTopInfo()
        {
            var vault          = new Windows.Security.Credentials.PasswordVault();
            var credentialList = vault.FindAllByResource(resourceName);

            credentialList[0].RetrievePassword();
            if (credentialList[0] != null)
            {
                try
                {
                    List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >();
                    paramList.Add(new KeyValuePair <string, string>("stuNum", credentialList[0].UserName));
                    string Topictemp = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/Topic/topicList", paramList);

                    JObject Tobj = JObject.Parse(Topictemp);
                    if (Int32.Parse(Tobj["status"].ToString()) == 200)
                    {
                        JArray TopicArray = Utils.ReadJso(Topictemp);
                        for (int i = 0; i < TopicArray.Count; i++)
                        {
                            Topic item = new Topic();
                            item.GetAttribute((JObject)TopicArray[i]);
                            if (item.imgdata.Equals(""))
                            {
                                item.imgdata = "/Assets/base.jpg"; item.color = "DarkGray";
                            }
                            item.keyword = $"#{item.keyword}#";
                            if (item.is_my_join)
                            {
                                MyTopicList.Add(item);
                            }
                            TopicList.Add(item);
                        }
                    }
                    if (MyTopicList.Count == 0)
                    {
                        MyTopic.Visibility = Visibility.Collapsed; noMyTopic.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        MyTopic.ItemsSource = MyTopicList;
                    }
                }
                catch
                {
                    NotifyPopup notifyPopup = new NotifyPopup("网络异常 无法读取事项~");
                    notifyPopup.Show();
                }
            }
        }
Esempio n. 22
0
 private async void Button_Save_Click(object sender, RoutedEventArgs e)
 {
     if (TextBox_account.Text == "" || PasswordBox_password.Password == "" || TextBox_serverIP.Text == "")
     {
         NotifyPopup notifyPopup = new NotifyPopup("?");
         notifyPopup.Show();
         return;
     }
     ConfigService.ApiUri       = TextBox_serverIP.Text;
     ConfigService.PhoneOrEmail = TextBox_account.Text;
     ConfigService.Password     = OtherHelper.Encrypt(PasswordBox_password.Password);
     ConfigService.SaveConfig();
     await CoreApplication.RequestRestartAsync(String.Empty);
 }
Esempio n. 23
0
 /// <summary>
 /// 播放上一首
 /// </summary>
 public static async void PlayLastSongs()
 {
     if (PlayedSongId != null && PlayedSongId.Count > 1) //上一个是当前歌曲,所以要上上一个
     {
         PlayedSongId.Remove(PlayedSongId.Last());       //移出当前
         for (int i = 0; i < 5; i++)
         {
             if (await ChangePlayingSong(PlayedSongId.Last(), PlayingService.PlayedSongList))
             {
                 break;
             }
         }
         NotifyPopup notifyPopup = new NotifyPopup("多次获取音乐失败,停止播放");
     }
 }
Esempio n. 24
0
 /// <summary>
 /// 播放上一首
 /// </summary>
 public static async void PlayLastRadio()
 {
     if (PlayedRadioId != null && PlayedRadioId.Count > 1) //上一个是当前电台,所以要上上一个
     {
         PlayedRadioId.Remove(PlayedRadioId.Last());       //移出当前
         for (int i = 0; i < 5; i++)
         {
             if (await ChangePlayingRadio(PlayedRadioId.Last(), PlayedRadioList))
             {
                 break;
             }
         }
         NotifyPopup notifyPopup = new NotifyPopup("多次获取音乐失败,停止播放");
     }
 }
Esempio n. 25
0
 public async void Button_isOrNotFavorite_Click(object sender, RoutedEventArgs e)
 {
     if (!PlayingService.IsPlayingSong)
     {
         NotifyPopup notifyPopup = new NotifyPopup("无法对电台节目进行此操作");
         notifyPopup.Show();
         return;
     }
     if (PlayingService.PlayingSong == null)
     {
         NotifyPopup notifyPopup = new NotifyPopup("无法获取音乐信息");
         notifyPopup.Show();
         return;
     }
     if (PlayingService.PlayingSong.isFavorite)//取消喜欢
     {
         if (await Task.Run(() => SongService.LoveOrDontLoveSong(PlayingService.PlayingSong.Id, false) == true))
         {
             NotifyPopup notifyPopup = new NotifyPopup("已取消喜欢", "\xE00C");
             notifyPopup.Show();
             TextBlock_isOrnotFavorite.Text        = "\xE006";
             PlayingService.PlayingSong.isFavorite = false;
             favoriteSongsRoot.ids.Remove(PlayingService.PlayingSong.Id);
         }
         else
         {
             NotifyPopup notifyPopup = new NotifyPopup("操作失败", "\xE10A");
             notifyPopup.Show();
         }
     }
     else//添加为喜欢的
     {
         if (await Task.Run(() => SongService.LoveOrDontLoveSong(PlayingService.PlayingSong.Id, true) == true))
         {
             NotifyPopup notifyPopup = new NotifyPopup("已添加为喜欢", "\xE00B", Colors.MediumSeaGreen);
             notifyPopup.Show();
             TextBlock_isOrnotFavorite.Text        = "\xE00B";
             PlayingService.PlayingSong.isFavorite = true;
             favoriteSongsRoot.ids.Add(PlayingService.PlayingSong.Id);
         }
         else
         {
             NotifyPopup notifyPopup = new NotifyPopup("操作失败", "\xE10A");
             notifyPopup.Show();
         }
     }
     WhenIsOrNotFavoriteChange();
 }
 public static void TipSystemError()
 {
     if (notifyPopup != null)
     {
         notifyPopup.Hide();
     }
     if (strCurrentLanguage.ToLower().Equals("zh-cn"))
     {
         notifyPopup = new NotifyPopup(LanguageHelper.strSystemError_zhcn);
     }
     else
     {
         notifyPopup = new NotifyPopup(LanguageHelper.strSystemError_en);
     }
     notifyPopup.Show();
 }
Esempio n. 27
0
        private async void PlayedRecord_Loaded(object sender, RoutedEventArgs e)
        {
            ProgressBar_Loading.Visibility = Visibility.Visible;
            RecordData recordData = await Task.Run(() => RecordDataService.GetRecordData(ConfigService.Uid, 1));

            if (recordData.WeekData != null)
            {
                ListBox_Week.ItemsSource = recordData.WeekData;
            }
            else
            {
                NotifyPopup notifyPopup = new NotifyPopup("获取最近一周记录失败");
                notifyPopup.Show();
            }
            ProgressBar_Loading.Visibility = Visibility.Collapsed;
        }
 public static void TipNotFlowersOrGrasses()
 {
     if (notifyPopup != null)
     {
         notifyPopup.Hide();
     }
     if (strCurrentLanguage.ToLower().Equals("zh-cn"))
     {
         notifyPopup = new NotifyPopup(LanguageHelper.strNotFlowersOrGrasses_zhcn);
     }
     else
     {
         notifyPopup = new NotifyPopup(LanguageHelper.strNotFlowersOrGrasses_en);
     }
     notifyPopup.Show();
 }
 public static void TipRecognizeFailed()
 {
     if (notifyPopup != null)
     {
         notifyPopup.Hide();
     }
     if (strCurrentLanguage.ToLower().Equals("zh-cn"))
     {
         notifyPopup = new NotifyPopup(LanguageHelper.strRecognizeFailed_zhcn);
     }
     else
     {
         notifyPopup = new NotifyPopup(LanguageHelper.strRecognizeFailed_en);
     }
     notifyPopup.Show();
 }
Esempio n. 30
0
        private async void Radio_Loaded(object sender, RoutedEventArgs e)
        {
            ProgressBar_Loading.Visibility = Visibility.Visible;
            DjRadio djRadio = await DjRadioService.GetUserCreatedRadio(ConfigService.Uid);

            if (djRadio == null)
            {
                NotifyPopup notifyPopup = new NotifyPopup("获取失败");
                notifyPopup.Show();
            }
            else
            {
                ListBox_Created.ItemsSource = djRadio.DjRadios;
            }
            ProgressBar_Loading.Visibility = Visibility.Collapsed;
        }