| | |
| | | { |
| | | public class Method |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 红外宝程序主入口 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="function"></param> |
| | | public void MainView(FrameLayout frame, Entity.Function function,Action action) |
| | | public void MainView(FrameLayout frame, Entity.Function function, Action action) |
| | | { |
| | | Pir pirDevice = new Pir(); |
| | | if (function != null) |
| | |
| | | PirMain.BackAction += () => |
| | | { |
| | | action?.Invoke(); |
| | | PirMain.BackAction = null; |
| | | }; |
| | | }); |
| | | }, Pir.currPir); |
| | |
| | | { |
| | | if (device != null) |
| | | { |
| | | |
| | | control.deviceId = device.deviceId; |
| | | //遥控器添加到列表; |
| | | if (null == Pir.currPir.FunctioList.Find((c) => c.deviceId == device.deviceId)) |
| | | { |
| | | Pir.currPir.FunctioList.Add(device); |
| | | } |
| | | frame.RemoveFromParent();//添加成功关闭弹窗 |
| | | action(control); |
| | | } |
| | |
| | | { |
| | | loading.Hide(); |
| | | Method method = new Method(); |
| | | method.ErrorShow(null,"读取红外宝列表失败"); |
| | | method.ErrorShow(null, "读取红外宝列表失败"); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | /// <param name="view">判断log父控件</param> |
| | | /// <param name="frame">log父控件</param> |
| | | /// <param name="dialog">log父控件</param> |
| | | public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog) |
| | | /// <param name="attributesStatus">学习按键</param> |
| | | public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, Entity.AttributesStatus attributesStatus=null) |
| | | { |
| | | |
| | | |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | if (view == "dialog") |
| | |
| | | } |
| | | else if (str == "删除按键") |
| | | { |
| | | // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); |
| | | if (attributesStatus != null) |
| | | { |
| | | responsePackNew = PirSend.CodeRemove(attributesStatus, control.deviceId); |
| | | } |
| | | } |
| | | else if (str == "获取设备详情") |
| | | { |
| | |
| | | else if (str == "获取遥控器列表") |
| | | { |
| | | responsePackNew = PirSend.ControlList(control.deviceId); |
| | | } |
| | | else if (str == "库码测试") |
| | | { |
| | | responsePackNew = PirSend.CodeTest(control); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | //自定义错误提示文本 |
| | | string eorroText = ""; |
| | | if (str == "删除") |
| | | { |
| | | } |
| | | else if (str == "修改名称") |
| | | { |
| | | |
| | | } |
| | | else if (str == "删除按键") |
| | | { |
| | | } |
| | | else if (str == "获取设备详情") |
| | | { |
| | | } |
| | | else if (str == "获取遥控器列表") |
| | | { |
| | | } |
| | | else if (str == "库码测试") |
| | | { |
| | | } |
| | | method.ErrorShow(responsePackNew, eorroText); |
| | | } |
| | | |
| | | }); |
| | |
| | | { |
| | | str = Language.StringByID(StringId.huoqushujushibao); |
| | | } |
| | | else if (text == "添加失败") |
| | | { |
| | | str = Language.StringByID(StringId.tianjiashibai); |
| | | } |
| | | else |
| | | { |
| | | if (responsePackNew != null) |
| | |
| | | case 3: { } break; |
| | | } |
| | | } |
| | | /// <summary> |
| | | ///指定刷新界面 |
| | | /// </summary> |
| | | /// <param name="strView">判断字符</param> |
| | | public static void RefreshView(string strView) |
| | | { |
| | | //标记是不是已经刷新完成 |
| | | bool if_bool = false; |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (strView == "PirMain") |
| | | { |
| | | if (view.GetType() == typeof(PirMain)) |
| | | { |
| | | //强制转换对象 |
| | | var f = (PirMain)view; |
| | | //移除所有子控件 |
| | | f.RemoveAll(); |
| | | //重新加载UI |
| | | f.Show(); |
| | | //退出for循环 |
| | | //break; |
| | | if_bool = true; |
| | | } |
| | | } |
| | | if (if_bool) |
| | | { |
| | | //退出for循环 |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 指定删除界面 |
| | | /// </summary> |
| | | /// <param name="strView">判断字符</param> |
| | | public static void RemoveView(string strView) |
| | | { |
| | | |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (strView == "PirMain") |
| | | { |
| | | if (view.GetType() == typeof(PirMain)) |
| | | { |
| | | //移除界面 |
| | | view.RemoveFromParent(); |
| | | } |
| | | |
| | | } |
| | | else if (strView == "AddControl") |
| | | { |
| | | |
| | | if (view.GetType() == typeof(AddControl)) |
| | | { |
| | | //找到移除 |
| | | view.RemoveFromParent(); |
| | | } |
| | | } |
| | | else if (strView == "AddControlComplete") |
| | | { |
| | | |
| | | if (view.GetType() == typeof(AddControlComplete)) |
| | | { |
| | | //找到移除 |
| | | view.RemoveFromParent(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | [Serializable] |