HDL-ON_Android/Assets/Language.ini
@@ -178,4 +178,6 @@ 5027=请输入列表名 5028=添加新的列表 5029=提示 5030=是否确认删除文件夹 5030=是否确认删除文件夹 5031=确认 5032=名称为空 HDL-ON_Android/Assets/Phone/MusicIcon/clear.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -394,6 +394,7 @@ <AndroidAsset Include="Assets\Phone\MusicIcon\next1Selected.png" /> <AndroidAsset Include="Assets\Phone\MusicIcon\prev.png" /> <AndroidAsset Include="Assets\Phone\MusicIcon\prve1.png" /> <AndroidAsset Include="Assets\Phone\MusicIcon\clear.png" /> </ItemGroup> <Import Project="..\HDL_ON\HDL_ON.projitems" Label="Shared" Condition="Exists('..\HDL_ON\HDL_ON.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> HDL_ON/Common/R.cs
@@ -233,5 +233,7 @@ public readonly static int addNewList = 5028; public readonly static int tip = 5029; public readonly static int delMusicFile = 5030; public readonly static int confirmMusic = 5031; public readonly static int nameNull = 5032; } } HDL_ON/HDL_ON.projitems
@@ -134,6 +134,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\Music\View\TipView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\Music\View\MusicSourceView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\Music\View\SongView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\Music\View\DialogView.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)UI\" /> HDL_ON/UI/Music/A31MusicModel.cs
@@ -47,7 +47,7 @@ /// <summary> /// 音乐播放器名称 /// </summary> public string Name; public string Name=string.Empty; /// <summary> /// 上一次更新的时间 /// </summary> HDL_ON/UI/Music/A31MusicSourcePage.cs
@@ -10,6 +10,8 @@ { Tag = "Music"; } public void Show() { #region 界面布局------ @@ -165,24 +167,25 @@ ///播放器修改名称事件 playNameView.clickBtn.MouseUpEventHandler += (sender, e) => { new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, A31MusicModel.Current.Name, (playerName) => new View.TipView().InputBox(StringId.modifyName, A31MusicModel.Current.Name, StringId.nameNull, (playerName) => { playNameView.inputTextBtn.Text = playerName; A31MusicModel.Current.Name = playerName; string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setDeviceName:" + A31MusicModel.Current.Name; SendMethod.SendCommand(url); }); }; ///蓝牙修改名称事件 bluetoothNameView.clickBtn.MouseUpEventHandler += (sender, e) => { new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, A31MusicModel.Current.Name, (playerName) => new View.TipView().InputBox(StringId.modifyName, A31MusicModel.Current.Name, StringId.nameNull, (bluetoothName) => { bluetoothNameView.inputTextBtn.Text = playerName; SendMethod.ModifyBluetoothName("MCU+PAS+BT" + playerName.Trim() + "*&"); bluetoothNameView.inputTextBtn.Text = bluetoothName; SendMethod.ModifyBluetoothName("MCU+PAS+BT" + bluetoothName.Trim() + "*&"); }); }; ///我的喜爱事件 myLoveView.clickBtn.MouseUpEventHandler += (sender, e) => { HDL_ON/UI/Music/USBMusicList.cs
@@ -213,7 +213,7 @@ musicViewFl.AddChidren(addIcon); addIcon.MouseUpEventHandler = (sender, e) => { new View.TipView { }.FieListView(); new View.DialogView { }.FieListView(); }; //点击控件 HDL_ON/UI/Music/View/DialogView.cs
New file @@ -0,0 +1,211 @@ using System; using System.Collections.Generic; using Shared; namespace HDL_ON.UI.Music.View { public class DialogView { public DialogView() { } 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(60), 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(152), 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) => { var fileNameList = new List<string>(); fileNameList.Clear(); foreach (var stringName in A31MusicModel.Current.FileLists) { fileNameList.Add(stringName.ListName); } new TipView().InputBox(StringId.addNewList, "", StringId.listNameNull, StringId.listNamesSame, fileNameList, (name) => { 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) => { var fileNameList = new List<string>(); fileNameList.Clear(); foreach (var stringName in A31MusicModel.Current.FileLists) { fileNameList.Add(stringName.ListName); } new TipView().InputBox(StringId.modifyName, list.ListName, StringId.listNameNull, StringId.listNamesSame, fileNameList, (name) => { 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 View.TipView().TipBox(StringId.tip, StringId.delMusicFile, () => { addFlieRow.RemoveFromParent(); A31MusicModel.Current.FileLists.Remove(list); A31MusicModel.Save(); }); }; } } } } HDL_ON/UI/Music/View/SizeClass.cs
@@ -33,6 +33,11 @@ /// </summary> public static uint WhiteColor = 0xFFFFFFFF; /// <summary> /// 红色背景颜色 /// </summary> public static uint RedColor = 0xFFFF4747; /// <summary> /// 线条颜色 /// </summary> public static uint LineColor =0xFFECEDEE; @@ -61,6 +66,8 @@ public static uint TextTimeColor = 0xFF798394; public static uint TextCancelColor = 0xFF798394; } public static class H_W { HDL_ON/UI/Music/View/TipView.cs
@@ -1,233 +1,458 @@ using System; using System.Collections.Generic; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI.Music.View { public class TipView:FrameLayout public class TipView { public void FieListView() /// <summary> /// 大框圆角值 /// </summary> public int RradiusFrameLayout = 15; /// <summary> /// 小框圆角值 /// </summary> public int radiusEditFrameLayout = 4; /// <summary> /// 输入框 /// </summary> /// <param name="titleId">标题文本</param> /// <param name="tnputEditTxet">输入文本</param> /// <param name="errorId_IsNullOrEmpty">输入框文本为空自定义提示错误文本</param> /// <param name="errorId_PresenceP">检索已存在名称自定义提示错误文本</param> /// <param name="confirmAction">回调函数</param> /// <param name="List">被检索列表</param> /// <param name="confirmAction">回调函数</param> public void InputBox(int titleId, string tnputEditTxet,int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string> confirmAction) { //主控件 Dialog dialog = new Dialog() { BackgroundColor = Color.PopupBackgroundColor, }; dialog.Show(); //父控件 FrameLayout frame = new FrameLayout { }; dialog.AddChidren(frame); frame.MouseUpEventHandler += (sen, e) => FrameLayout whiteView = new FrameLayout() { dialog.Close(); }; //白色快父控件 FrameLayout dialogFra = new FrameLayout() { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(187), Width = Application.GetRealWidth(344), Height = Application.GetRealHeight(460), //Gravity = Gravity.Center, X=Application.GetRealWidth(53), Y = Application.GetRealHeight(264), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(172), BackgroundColor = Color.WhiteColor, Radius = (uint)Application.GetRealHeight(12), BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), }; frame.AddChidren(dialogFra); //显示头部信息父控件 FrameLayout topFra = new FrameLayout() dialog.AddChidren(whiteView); Button btnTitle = new Button() { Width = Application.GetRealWidth(344), Height = Application.GetRealHeight(70), Y = Application.GetRealHeight(20), X=Application.GetRealWidth(35), Height = Application.GetRealHeight(22), Width=Application.GetRealWidth(200), TextColor =Color.SelectedColor, TextSize =TextSize.Text16, TextAlignment = TextAlignment.Center, TextID = titleId, }; dialogFra.AddChidren(topFra); //取消控件 Button cancelnBtn = new Button whiteView.AddChidren(btnTitle); FrameLayout editBjView = new FrameLayout() { 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, // Gravity = Gravity.CenterHorizontal, Y = btnTitle.Bottom + Application.GetRealHeight(16), X=Application.GetRealWidth(24), Width = Application.GetRealWidth(222), Height = Application.GetRealHeight(40), BackgroundColor =Color.ViewColor, BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), }; whiteView.AddChidren(editBjView); EditText editText = new EditText() { X = Application.GetRealWidth(12), Y=Application.GetRealHeight(10), Width = Application.GetRealWidth(160), Height=Application.GetRealHeight(20), Text = tnputEditTxet, TextColor = Color.TextColor, TextSize = TextSize.Text14, TextAlignment=TextAlignment.CenterLeft, }; topFra.AddChidren(cancelnBtn); cancelnBtn.MouseUpEventHandler += (sen, e) => editBjView.AddChidren(editText); Button clearIconBtn = new Button { X = Application.GetRealWidth(194), Y = Application.GetRealHeight(8), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "MusicIcon/clear.png", }; editBjView.AddChidren(clearIconBtn); clearIconBtn.MouseUpEventHandler += (sender, e) => { editText.Text = ""; }; Button btnLine = new Button() { Y = whiteView.Height-Application.GetRealHeight(44+1), Height = Application.GetRealHeight(1), BackgroundColor =Color.LineColor, }; whiteView.AddChidren(btnLine); Button btnCancel = new Button() { Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextColor = Color.TextCancelColor, TextSize = TextSize.Text16, TextID = StringId.cancelMusic, }; whiteView.AddChidren(btnCancel); Button btnConfirm = new Button() { X = btnCancel.Right, Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextColor = Color.WhiteColor, IsBold = true, TextSize = TextSize.Text16, TextID = StringId.confirmMusic, BackgroundColor = Color.SelectedColor, Gravity = Gravity.BottomRight, }; whiteView.AddChidren(btnConfirm); btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); dialog.Show(); btnCancel.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; //标题控件 Button txetBtn = new Button Button btnTip = new Button { X = cancelnBtn.Right + Application.GetRealWidth(20), Y = Application.GetRealHeight(23), Width = Application.GetRealWidth(100), Width = Application.GetRealWidth(0), }; whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件 btnConfirm.MouseUpEventHandler += (sender, e) => { string listNameText = editText.Text.Trim(); if (string.IsNullOrEmpty(listNameText) || List.Contains(listNameText)) { string tipMsgString = ""; if (string.IsNullOrEmpty(editText.Text.Trim())) { tipMsgString = Language.StringByID(errorId_IsNullOrEmpty); } else { tipMsgString = Language.StringByID(errorId_PresenceP); } whiteView.Height = Application.GetRealHeight(183); btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1); btnCancel.Y = btnLine.Bottom; btnConfirm.Y = btnLine.Bottom; btnConfirm.Gravity = Gravity.BottomRight; btnTip.X = Application.GetRealWidth(24); btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12); btnTip.Width = Application.GetRealWidth(222); btnTip.Height = Application.GetRealHeight(17); btnTip.Text = tipMsgString; btnTip.TextColor = Color.RedColor; btnTip.TextSize = TextSize.Text12; btnTip.TextAlignment = TextAlignment.CenterLeft; return; } confirmAction(editText.Text.Trim()); dialog.Close(); }; } /// <summary> /// 输入框 /// </summary> /// <param name="titleId">标题文本</param> /// <param name="tnputEditTxet">输入文本</param> /// <param name="errorId_IsNullOrEmpty">输入框本文为空自定义提示错误文本</param> /// <param name="confirmAction">回调函数</param> public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction) { Dialog dialog = new Dialog() { BackgroundColor = Color.PopupBackgroundColor, }; FrameLayout whiteView = new FrameLayout() { //Gravity = Gravity.Center, X = Application.GetRealWidth(53), Y = Application.GetRealHeight(264), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(172), BackgroundColor = Color.WhiteColor, BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), }; dialog.AddChidren(whiteView); Button btnTitle = new Button() { Y = Application.GetRealHeight(20), X = Application.GetRealWidth(35), Height = Application.GetRealHeight(22), TextColor = Color.TextColor, Width = Application.GetRealWidth(200), TextColor = Color.SelectedColor, TextSize = TextSize.Text16, TextAlignment = TextAlignment.Center, TextID = StringId.myList, IsBold=true, }; topFra.AddChidren(txetBtn); TextID = titleId, //添加图标控件 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); whiteView.AddChidren(btnTitle); VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout FrameLayout editBjView = new FrameLayout() { Y = Application.GetRealHeight(70), Height = dialogFra.Height - Application.GetRealHeight(70), Width = Application.GetRealWidth(344), // Gravity = Gravity.CenterHorizontal, Y = btnTitle.Bottom + Application.GetRealHeight(16), X = Application.GetRealWidth(24), Width = Application.GetRealWidth(222), Height = Application.GetRealHeight(40), BackgroundColor = Color.ViewColor, BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), }; dialogFra.AddChidren(verticalScrolViewLayout); addIconBtn.MouseUpEventHandler += (sender, e) => whiteView.AddChidren(editBjView); EditText editText = new EditText() { 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); }); X = Application.GetRealWidth(12), Y = Application.GetRealHeight(10), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(20), Text = tnputEditTxet, TextColor = Color.TextColor, TextSize = TextSize.Text14, TextAlignment = TextAlignment.CenterLeft, }; FileView(verticalScrolViewLayout); editBjView.AddChidren(editText); Button clearIconBtn = new Button { X = Application.GetRealWidth(194), Y = Application.GetRealHeight(8), Width = Application.GetMinRealAverage(24), Height = Application.GetMinRealAverage(24), UnSelectedImagePath = "MusicIcon/clear.png", }; editBjView.AddChidren(clearIconBtn); clearIconBtn.MouseUpEventHandler += (sender, e) => { editText.Text = ""; }; Button btnLine = new Button() { Y = whiteView.Height - Application.GetRealHeight(44 + 1), Height = Application.GetRealHeight(1), BackgroundColor = Color.LineColor, }; whiteView.AddChidren(btnLine); Button btnCancel = new Button() { Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextColor = Color.TextCancelColor, TextSize = TextSize.Text16, TextID = StringId.cancelMusic, }; whiteView.AddChidren(btnCancel); Button btnConfirm = new Button() { X = btnCancel.Right, Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextColor = Color.WhiteColor, IsBold = true, TextSize = TextSize.Text16, TextID = StringId.confirmMusic, BackgroundColor = Color.SelectedColor, Gravity=Gravity.BottomRight, }; whiteView.AddChidren(btnConfirm); btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); dialog.Show(); btnCancel.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; Button btnTip = new Button { Width = Application.GetRealWidth(0), }; whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件 btnConfirm.MouseUpEventHandler += (sender, e) => { if (string.IsNullOrEmpty(editText.Text.Trim())) { whiteView.Height = Application.GetRealHeight(183); btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1); btnCancel.Y = btnLine.Bottom; btnConfirm.Y = btnLine.Bottom; btnConfirm.Gravity = Gravity.BottomRight; btnTip.X = Application.GetRealWidth(24); btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12); btnTip.Width = Application.GetRealWidth(222); btnTip.Height = Application.GetRealHeight(17); btnTip.Text = Language.StringByID(errorId_IsNullOrEmpty); btnTip.TextColor = Color.RedColor; btnTip.TextSize = TextSize.Text12; btnTip.TextAlignment = TextAlignment.CenterLeft; return; } confirmAction(editText.Text.Trim()); dialog.Close(); }; } void FileView(VerticalScrolViewLayout verticalScrolViewLayout) /// <summary> /// 确定提示框 /// </summary> /// <param name="titleId">标题文本</param> /// <param name="tipTxet">自定义提示文本</param> /// <param name="confirmAction">回调函数</param> public void TipBox(int titleId, int tipTxet, Action confirmAction) { verticalScrolViewLayout.RemoveAll(); for (int i = 0; i < A31MusicModel.Current.FileLists.Count; i++) Dialog dialog = new Dialog() { 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); BackgroundColor = Color.PopupBackgroundColor, }; //文件名控件 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); FrameLayout whiteView = new FrameLayout() { //Gravity = Gravity.Center, X = Application.GetRealWidth(53), Y = Application.GetRealHeight(264), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(140), BackgroundColor = Color.WhiteColor, BorderColor = 0x00000000, BorderWidth = 0, Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), }; dialog.AddChidren(whiteView); ///编辑控件 var editBtn = new Button { BackgroundColor = Color.MusicEditColor, Text = Language.StringByID(StringId.editMusic), TextColor = Color.WhiteColor, TextSize = TextSize.Text16, }; addFlieRow.AddRightView(editBtn); Button titleBtn = new Button() { Y = Application.GetRealHeight(20), X = Application.GetRealWidth(35), Height = Application.GetRealHeight(22), Width = Application.GetRealWidth(270 - 35 * 2), TextColor = Color.SelectedColor, TextSize = TextSize.Text16, TextAlignment = TextAlignment.Center, TextID = titleId, }; whiteView.AddChidren(titleBtn); 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; } } Button tipBtn = new Button() { Y = titleBtn.Bottom + Application.GetRealHeight(8), X = Application.GetRealWidth(20), Height = Application.GetRealHeight(22), Width = Application.GetRealWidth(270 - 20 * 2), TextColor = Color.TextCancelColor, TextSize = TextSize.Text12, TextAlignment = TextAlignment.Center, TextID = tipTxet, }; whiteView.AddChidren(tipBtn); 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(); } }); }; Button btnLine = new Button() { Y = whiteView.Height - Application.GetRealHeight(44 + 1), Height = Application.GetRealHeight(1), BackgroundColor = Color.LineColor, }; whiteView.AddChidren(btnLine); ///删除控件 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(); }); Button btnCancel = new Button() { Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextColor = Color.TextCancelColor, TextSize = TextSize.Text16, TextID = StringId.cancelMusic, }; whiteView.AddChidren(btnCancel); }; Button btnConfirm = new Button() { X = btnCancel.Right, Y = btnLine.Bottom, Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, TextColor = Color.WhiteColor, IsBold = true, TextSize = TextSize.Text16, TextID = StringId.confirmMusic, BackgroundColor = Color.SelectedColor, Gravity = Gravity.BottomRight, }; whiteView.AddChidren(btnConfirm); btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); dialog.Show(); btnCancel.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; } btnConfirm.MouseUpEventHandler += (sender, e) => { confirmAction(); dialog.Close(); }; } } } HDL_ON/UI/UI0-Public/PublicAssmebly.cs
@@ -1,4 +1,5 @@ using System; using System.Collections.Generic; using System.Threading; using HDL_ON.Entity; using HDL_ON.UI.CSS; @@ -8,12 +9,63 @@ { public partial class PublicAssmebly { void EditParaterEvent(Button btnConfirm, int errorId_IsNullOrEmpty, int errorId_ContainsPar, List<string> list, EditText editText, Action<string> callBackAction, FrameLayout contentView, Button btnLine, Button btnBottomLine, Button btnCancel, FrameLayout editView, Dialog dialog) { btnConfirm.MouseUpEventHandler += (sender, e) => { btnConfirm.IsSelected = false; if (string.IsNullOrEmpty(editText.Text.Trim()) || list.Contains(editText.Text.Trim())) { string tipMsgString = ""; if (string.IsNullOrEmpty(editText.Text.Trim())) { tipMsgString = Language.StringByID(errorId_IsNullOrEmpty); } else { tipMsgString = Language.StringByID(errorId_ContainsPar); } contentView.Height = Application.GetRealHeight(183); btnLine.Y = Application.GetRealHeight(139); btnBottomLine.Y = btnLine.Bottom; btnCancel.Y = btnLine.Bottom; btnConfirm.Y = btnLine.Bottom; var btnTip = new Button() { X = editView.X, Y = editView.Bottom, Width = Application.GetRealWidth(182), Height = Application.GetRealHeight(30), Text = tipMsgString, TextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.TextFontSize, IsMoreLines = true, TextAlignment = TextAlignment.CenterLeft, }; contentView.AddChidren(btnTip); return; } callBackAction(editText.Text.Trim()); dialog.Close(); }; } /// <summary> /// 加载修改参数的小弹窗 /// 保存按钮事件需要将 /// </summary> /// <param name="callBackAction">回调函数</param> public void LoadDialog_EditParater(int titleId, string editParater, Action<string> callBackAction) public void LoadDialog_EditParater(int titleId, string editParater, Action<string> callBackAction, int errorId_IsNullOrEmpty, int errorId_ContainsPar, List<string> baseList) { Dialog dialog = new Dialog() { @@ -116,66 +168,106 @@ dialog.Show(); btnCancel.MouseDownEventHandler += (sender, e) => { btnCancel.MouseDownEventHandler += (sender, e) => { btnCancel.IsSelected = true; }; btnCancel.MouseUpEventHandler += (sender, e) => { btnCancel.MouseUpEventHandler += (sender, e) => { btnCancel.IsSelected = false; dialog.Close(); }; btnConfirm.MouseDownEventHandler += (sender, e) => { btnConfirm.MouseDownEventHandler += (sender, e) => { btnConfirm.IsSelected = true; }; btnConfirm.MouseUpEventHandler += (sender, e) => { btnConfirm.IsSelected = false; //需要提示错误信息在窗口弹窗之上的 if ((titleId == StringId.EditFloorName && etParater.Text.Trim() != editParater) || titleId == StringId.AddFloors) { var tipMsgString = titleId == StringId.EditFloorName ? Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist) : Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist); EditParaterEvent(btnConfirm, errorId_IsNullOrEmpty, errorId_ContainsPar, baseList, etParater, callBackAction, contentView, btnLine, btnBottomLine, btnCancel, editView, dialog); //btnConfirm.MouseUpEventHandler += (sender, e) => //{ // btnConfirm.IsSelected = false; if (string.IsNullOrEmpty(etParater.Text.Trim())) { // tipMsgString = Language.StringByID(StringId.FloorNameCannotBeEmpty); return; } // if (string.IsNullOrEmpty(etParater.Text.Trim())|| list.Contains(etParater.Text.Trim())) // { // string tipMsgString = ""; // if (string.IsNullOrEmpty(etParater.Text.Trim())) // { // tipMsgString = Language.StringByID(errorId_IsNullOrEmpty); // } // else // { // tipMsgString = Language.StringByID(errorId_ContainsPar); // } if (DB_ResidenceData.residenceData.floors.Contains(etParater.Text.Trim())) { contentView.Height = Application.GetRealHeight(183); btnLine.Y = Application.GetRealHeight(139); btnBottomLine.Y = btnLine.Bottom; btnCancel.Y = btnLine.Bottom; btnConfirm.Y = btnLine.Bottom; // contentView.Height = Application.GetRealHeight(183); // btnLine.Y = Application.GetRealHeight(139); // btnBottomLine.Y = btnLine.Bottom; // btnCancel.Y = btnLine.Bottom; // btnConfirm.Y = btnLine.Bottom; var btnTip = new Button() { X = editView.X, Y = editView.Bottom, Width = Application.GetRealWidth(182), Height = Application.GetRealHeight(30), Text = tipMsgString, TextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.TextFontSize, }; contentView.AddChidren(btnTip); // var btnTip = new Button() // { // X = editView.X, // Y = editView.Bottom, // Width = Application.GetRealWidth(182), // Height = Application.GetRealHeight(30), // Text = tipMsgString, // TextColor = CSS_Color.WarningColor, // TextSize = CSS_FontSize.TextFontSize, // }; // contentView.AddChidren(btnTip); return; } // return; // } callBackAction(etParater.Text.Trim()); } // //需要提示错误信息在窗口弹窗之上的 // if ((titleId == StringId.EditFloorName && etParater.Text.Trim() != editParater) || titleId == StringId.AddFloors) // { // var tipMsgString = titleId == StringId.EditFloorName ? Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist) : Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist); if (titleId == StringId.RoomName || titleId == StringId.ChangeName || titleId == StringId.ResidenceName || titleId == StringId.UesrName) { if (editParater != etParater.Text.Trim()) { callBackAction(etParater.Text.Trim()); } } dialog.Close(); }; // if (string.IsNullOrEmpty(etParater.Text.Trim())) // { // tipMsgString = Language.StringByID(StringId.FloorNameCannotBeEmpty); // //return; // } // if (DB_ResidenceData.residenceData.floors.Contains(etParater.Text.Trim())) // { // contentView.Height = Application.GetRealHeight(183); // btnLine.Y = Application.GetRealHeight(139); // btnBottomLine.Y = btnLine.Bottom; // btnCancel.Y = btnLine.Bottom; // btnConfirm.Y = btnLine.Bottom; // var btnTip = new Button() // { // X = editView.X, // Y = editView.Bottom, // Width = Application.GetRealWidth(182), // Height = Application.GetRealHeight(30), // Text = tipMsgString, // TextColor = CSS_Color.WarningColor, // TextSize = CSS_FontSize.TextFontSize, // }; // contentView.AddChidren(btnTip); // return; // } // callBackAction(etParater.Text.Trim()); // } // if(titleId == StringId.RoomName || titleId == StringId.ChangeName || titleId == StringId.ResidenceName || titleId == StringId.UesrName) // { // if(editParater != etParater.Text.Trim()) // { // callBackAction(etParater.Text.Trim()); // } // } // dialog.Close(); //}; } @@ -185,7 +277,7 @@ /// 保存按钮事件需要将 /// </summary> /// <param name="callBackAction">回调函数</param> public void LoadDialog_EditParater(int titleId, int tipTitleId, string editParater, Action<string> callBackAction) public void LoadDialog_EditParater(int titleId, int tipTitleId, string editParater, Action<string> callBackAction, int errorId_IsNullOrEmpty, int errorId_ContainsPar, List<string> baseList) { Dialog dialog = new Dialog() { @@ -301,66 +393,70 @@ dialog.Show(); btnCancel.MouseDownEventHandler += (sender, e) => { btnCancel.MouseDownEventHandler += (sender, e) => { btnCancel.IsSelected = true; }; btnCancel.MouseUpEventHandler += (sender, e) => { btnCancel.MouseUpEventHandler += (sender, e) => { btnCancel.IsSelected = false; dialog.Close(); }; btnConfirm.MouseDownEventHandler += (sender, e) => { btnConfirm.MouseDownEventHandler += (sender, e) => { btnConfirm.IsSelected = true; }; btnConfirm.MouseUpEventHandler += (sender, e) => { btnConfirm.IsSelected = false; //需要提示错误信息在窗口弹窗之上的 if ((titleId == StringId.EditFloorName && etParater.Text.Trim() != editParater) || titleId == StringId.AddFloors) { var tipMsgString = titleId == StringId.EditFloorName ? Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist) : Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist); EditParaterEvent(btnConfirm, errorId_IsNullOrEmpty, errorId_ContainsPar, baseList, etParater, callBackAction, contentView, btnLine, btnBottomLine, btnCancel, editView, dialog); //btnConfirm.MouseUpEventHandler += (sender, e) => //{ // btnConfirm.IsSelected = false; // //需要提示错误信息在窗口弹窗之上的 // if ((titleId == StringId.EditFloorName && etParater.Text.Trim() != editParater) || titleId == StringId.AddFloors) // { // var tipMsgString = titleId == StringId.EditFloorName ? Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist) : Language.StringByID(StringId.AddFloorFailed_FloorAlreadyExist); if (string.IsNullOrEmpty(etParater.Text.Trim())) { tipMsgString = Language.StringByID(StringId.FloorNameCannotBeEmpty); return; } // if (string.IsNullOrEmpty(etParater.Text.Trim())) // { // tipMsgString = Language.StringByID(StringId.FloorNameCannotBeEmpty); // return; // } if (DB_ResidenceData.residenceData.floors.Contains(etParater.Text.Trim())) { contentView.Height = Application.GetRealHeight(183); btnLine.Y = Application.GetRealHeight(139); btnBottomLine.Y = btnLine.Bottom; btnCancel.Y = btnLine.Bottom; btnConfirm.Y = btnLine.Bottom; // if (DB_ResidenceData.residenceData.floors.Contains(etParater.Text.Trim())) // { // contentView.Height = Application.GetRealHeight(183); // btnLine.Y = Application.GetRealHeight(139); // btnBottomLine.Y = btnLine.Bottom; // btnCancel.Y = btnLine.Bottom; // btnConfirm.Y = btnLine.Bottom; // var btnTip = new Button() // { // X = editView.X, // Y = editView.Bottom, // Width = Application.GetRealWidth(182), // Height = Application.GetRealHeight(30), // Text = tipMsgString, // TextColor = CSS_Color.WarningColor, // TextSize = CSS_FontSize.TextFontSize, // }; // contentView.AddChidren(btnTip); var btnTip = new Button() { X = editView.X, Y = editView.Bottom, Width = Application.GetRealWidth(182), Height = Application.GetRealHeight(30), Text = tipMsgString, TextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.TextFontSize, }; contentView.AddChidren(btnTip); // return; // } return; } // callBackAction(etParater.Text.Trim()); // } callBackAction(etParater.Text.Trim()); } if (titleId == StringId.RoomName || titleId == StringId.ChangeName || titleId == StringId.ResidenceName || titleId == StringId.UesrName || titleId == StringId.addNewList) { if (editParater != etParater.Text.Trim()) { callBackAction(etParater.Text.Trim()); } } dialog.Close(); }; // if (titleId == StringId.RoomName || titleId == StringId.ChangeName || titleId == StringId.ResidenceName || titleId == StringId.UesrName) // { // if (editParater != etParater.Text.Trim()) // { // callBackAction(etParater.Text.Trim()); // } // } // dialog.Close(); //}; } @@ -531,7 +627,8 @@ dialog.Show(); new Thread(() => { new Thread(() => { Thread.Sleep(1500); Application.RunOnMainThread(() => { HDL_ON/UI/UI0-Public/TopViewDivBLL.cs
@@ -59,7 +59,7 @@ break; } } new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors,newFloorName , callBackAction); // new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors,newFloorName , callBackAction); break; case "rooms": callBack("", ""); HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
@@ -172,7 +172,7 @@ }) { IsBackground = true }.Start(); }; new PublicAssmebly().LoadDialog_EditParater(StringId.UesrName, MainPage.LoginUser.userName, callBack); // new PublicAssmebly().LoadDialog_EditParater(StringId.UesrName, MainPage.LoginUser.userName, callBack); }; btnUserName.MouseUpEventHandler = eventHandler; btnEditUserNameIcon.MouseUpEventHandler = eventHandler; HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPageBLL.cs
@@ -39,7 +39,7 @@ row.Tag = newName; } }; new PublicAssmebly().LoadDialog_EditParater(StringId.EditFloorName, btn.Text, editCallBack); // new PublicAssmebly().LoadDialog_EditParater(StringId.EditFloorName, btn.Text, editCallBack); }; } HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/ResidentialManagePageBLL.cs
@@ -95,7 +95,7 @@ }) { IsBackground = true }.Start(); }; new PublicAssmebly().LoadDialog_EditParater(StringId.ResidenceName, DB_ResidenceData.residenceData.residecenInfo.Name, callBack); // new PublicAssmebly().LoadDialog_EditParater(StringId.ResidenceName, DB_ResidenceData.residenceData.residecenInfo.Name, callBack); }; btnResidenceName.MouseUpEventHandler = eventHandler; btnEditResidenceNameIcon.MouseUpEventHandler = eventHandler; @@ -142,7 +142,7 @@ }); } }; new PublicAssmebly().LoadDialog_EditParater(StringId.ResidenceName, DB_ResidenceData.residenceData.residecenInfo.Name, callBack); // new PublicAssmebly().LoadDialog_EditParater(StringId.ResidenceName, DB_ResidenceData.residenceData.residecenInfo.Name, callBack); }; btnResidenceAddress.MouseUpEventHandler = eventHandler; btnLocationAddressIcon.MouseUpEventHandler = eventHandler; HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditPageBLL.cs
@@ -121,7 +121,7 @@ }; EventHandler<MouseEventArgs> eventHandler = (sender, e) => { new PublicAssmebly().LoadDialog_EditParater(StringId.RoomName, room.name, callBack); //new PublicAssmebly().LoadDialog_EditParater(StringId.RoomName, room.name, callBack); }; btnEditRoomNameIcon.MouseUpEventHandler = eventHandler; roomNameRow.MouseUpEventHandler = eventHandler; HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs
@@ -37,7 +37,7 @@ btnFunctionName.Text = name; DB_ResidenceData.residenceData.SaveResidenceData(); }; new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, function.name, callBackAction); //new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, function.name, callBackAction); }; btnEditName.MouseUpEventHandler = eventHandler; btnFunctionName.MouseUpEventHandler = eventHandler;