private void DeleteMusicButton_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; Music music = btn.Tag as Music; InputStringWindow inputStringWindow = new InputStringWindow("删除音乐?", "点击确认删除"); if (inputStringWindow.ShowDialog() == true) { PageModel.PlayList.Remove(music); } }
private void AddNewPlayListButton_Click(object sender, RoutedEventArgs e) { InputStringWindow inputStringWindow = new InputStringWindow("添加歌单", "歌单链接"); if (inputStringWindow.ShowDialog() == true) { string url = inputStringWindow.InputString; Thread thread = new Thread(new ThreadStart(() => AddNewPlayList(url))); thread.IsBackground = true; thread.Start(); } }
public bool GetStringFromInputStringWindow(string title, string subtitle, out string result) { InputStringWindow inputStringWindow = new InputStringWindow(title, subtitle); if (inputStringWindow.ShowDialog() == true) { result = inputStringWindow.InputString; return(true); } else { result = ""; return(false); } }
/// <summary> /// 请求输入; /// </summary> /// <param name="title">对话框标题</param> /// <param name="des">对话框内容</param> /// <returns></returns> public static string Show(string des = "", string title = "", string val = "") { var window = new InputStringWindow(title, des); window.Val = val; window.ShowDialog(); if (window.InputResult == true) { return(window.Val); } else { return(null); } }