using System; using Shared; namespace HDL_ON.UI.Music.View { public class TipView:FrameLayout { public void FieListView() { //主控件 Dialog dialog = new Dialog() { BackgroundColor = Color.PopupBackgroundColor, }; dialog.Show(); //父控件 FrameLayout frame = new FrameLayout { }; dialog.AddChidren(frame); frame.MouseUpEventHandler += (sen, e) => { dialog.Close(); }; //白色快父控件 FrameLayout dialogFra = new FrameLayout() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(187), Width = Application.GetRealWidth(344), Height = Application.GetRealHeight(460), BackgroundColor = Color.WhiteColor, Radius = (uint)Application.GetRealHeight(12), }; frame.AddChidren(dialogFra); //显示头部信息父控件 FrameLayout topFra = new FrameLayout() { Width = Application.GetRealWidth(344), Height = Application.GetRealHeight(70), }; dialogFra.AddChidren(topFra); //取消控件 Button cancelnBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(24), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(20), TextID = StringId.cancelMusic, TextAlignment = TextAlignment.CenterLeft, TextColor = Color.MusicNoTxetColor, TextSize = TextSize.Text14, }; topFra.AddChidren(cancelnBtn); cancelnBtn.MouseUpEventHandler += (sen, e) => { dialog.Close(); }; //标题控件 Button txetBtn = new Button { X = cancelnBtn.Right + Application.GetRealWidth(20), Y = Application.GetRealHeight(23), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(22), TextColor = Color.TextColor, TextSize = TextSize.Text16, TextAlignment = TextAlignment.Center, TextID = StringId.myList, IsBold=true, }; topFra.AddChidren(txetBtn); //添加图标控件 Button addIconBtn = new Button { X = Application.GetRealWidth(304), Y = Application.GetRealHeight(20), Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), UnSelectedImagePath = "MusicIcon/addMusic.png", }; topFra.AddChidren(addIconBtn); VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout { Y = Application.GetRealHeight(70), Height = dialogFra.Height - Application.GetRealHeight(70), Width = Application.GetRealWidth(344), }; dialogFra.AddChidren(verticalScrolViewLayout); addIconBtn.MouseUpEventHandler += (sender, e) => { new PublicAssmebly().LoadDialog_EditParater(StringId.addNewList, StringId.listNameInput, "", (name) => { if (string.IsNullOrEmpty(name)) { //列表名为空 new PublicAssmebly().TipMsg(StringId.tip, StringId.listNameNull); return; } foreach (var lists in A31MusicModel.Current.FileLists) { if (lists.ListName == name) { //列表名称相同 new PublicAssmebly().TipMsg(StringId.tip, StringId.listNamesSame); return; } } A31MusicModel.Current.FileLists.Add(new FileListInfo { ListName = name, }); A31MusicModel.Save(); FileView(verticalScrolViewLayout); }); }; FileView(verticalScrolViewLayout); } void FileView(VerticalScrolViewLayout verticalScrolViewLayout) { verticalScrolViewLayout.RemoveAll(); for (int i = 0; i < A31MusicModel.Current.FileLists.Count; i++) { var list = A31MusicModel.Current.FileLists[i]; RowLayout addFlieRow = new RowLayout { Height = Application.GetRealHeight(78), LineColor = Color.WhiteColor, SubViewWidth = Application.GetRealWidth(80),//改变编辑控件宽度多少; }; verticalScrolViewLayout.AddChidren(addFlieRow); //文件图标 Button fileIconBtn = new Button { X = Application.GetRealWidth(12), Y = Application.GetRealHeight(8), Width = Application.GetMinRealAverage(62), Height = Application.GetMinRealAverage(62), UnSelectedImagePath = "MusicIcon/file.png", }; addFlieRow.AddChidren(fileIconBtn); //文件名控件 Button fileNameBtn = new Button { X = fileIconBtn.Right + Application.GetRealWidth(12), Y = Application.GetRealHeight(29), Width = Application.GetRealWidth(189), Height = Application.GetRealHeight(20), TextColor = Color.TextColor, TextSize = TextSize.Text14, TextAlignment = TextAlignment.CenterLeft, Text = list.ListName, }; addFlieRow.AddChidren(fileNameBtn); ///编辑控件 var editBtn = new Button { BackgroundColor = Color.MusicEditColor, Text = Language.StringByID(StringId.editMusic), TextColor = Color.WhiteColor, TextSize = TextSize.Text16, }; addFlieRow.AddRightView(editBtn); editBtn.MouseUpEventHandler += (sender, e) => { new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, list.ListName, (name) => { if (string.IsNullOrEmpty(name)) { //列表名为空 new PublicAssmebly().TipMsg(StringId.tip, StringId.listNameNull); return; } foreach (var lists in A31MusicModel.Current.FileLists) { if (lists.ListName == name) { //列表名称相同 new PublicAssmebly().TipMsg(StringId.tip, StringId.listNamesSame); return; } } var file = A31MusicModel.Current.FileLists.Find((c) => { return c.ListName == list.ListName; }); if (file != null) { if (file.ListName != name) { ///修改名称不一样更新保存 file.ListName = name; fileNameBtn.Text = name; A31MusicModel.Save(); } } if (list.ListName != name) { ///修改名称不一样更新保存 list.ListName = name; fileNameBtn.Text = name; A31MusicModel.Save(); } }); }; ///删除控件 var delBtn = new Button { BackgroundColor = Color.MusicDelColor, Text = Language.StringByID(StringId.delMusic), TextColor = Color.WhiteColor, TextSize=TextSize.Text16, }; addFlieRow.AddRightView(delBtn); delBtn.MouseUpEventHandler += (sender, e) => { new PublicAssmebly().TipMsg(StringId.tip, StringId.delMusicFile, () => { addFlieRow.RemoveFromParent(); A31MusicModel.Current.FileLists.Remove(list); A31MusicModel.Save(); }); }; } } } }