/// <summary> /// 单个发布信息 /// </summary> public void SinglePublishMessageInfo(IdleFishActionViewModel idleFishViewModel, UploadFilesToPhoneViewModel uploadFilesViewModel) { OpenIdleFish(idleFishViewModel.Device); ///获取当前手机的分辨率 var wmPoint = baseAction.GetWMSize(idleFishViewModel.Device); ///点击首页发布按钮 baseAction.actionDirectStr(idleFishViewModel.Device, 360, 1205, wmPoint); ///循环检测是否进入发布页面 baseAction.CircleDetection("PublishEntryActivity", idleFishViewModel.Device, false); ///点击发布闲置 baseAction.actionDirectStr(idleFishViewModel.Device, 147, 924, wmPoint); ///循环检测是否进入拍摄界面 baseAction.CircleDetection("MultiMediaStudioActivity", idleFishViewModel.Device, false); ///点击相册选择照片 baseAction.actionDirectStr(idleFishViewModel.Device, 120, 1235, wmPoint); ///循环检测是否进入图片选择界面 baseAction.CircleDetection("MultiMediaStudioActivity", idleFishViewModel.Device, false); ///选择照片 baseAction.SelectImage(uploadFilesViewModel.Files, wmPoint, idleFishViewModel.Device, 147, 97, 180, 180); ///分析确定按钮 IdleFishActionViewModel currentViewModel = func(new IdleFishActionViewModel() { Device = idleFishViewModel.Device, XMLName = "idlefish_selectimage" }, "//node[@class='android.widget.Button']"); //点击确定按钮 baseAction.actionDirectStr(idleFishViewModel.Device, (currentViewModel.LeftWidth + currentViewModel.RightWidth) / 2, (currentViewModel.TopHeight + currentViewModel.BottomHeight) / 2, wmPoint); ///循环检测是否进入编辑界面 baseAction.CircleDetection("MultiMediaEditorActivity", idleFishViewModel.Device, false); //分析下一步按钮的位置 currentViewModel.XMLName = "effect_next"; currentViewModel = func(currentViewModel, "//node[@resource-id='com.taobao.idlefish:id/effect_next']"); //点击下一步按钮 baseAction.actionDirectStr(idleFishViewModel.Device, (currentViewModel.LeftWidth + currentViewModel.RightWidth) / 2, (currentViewModel.TopHeight + currentViewModel.BottomHeight) / 2, wmPoint); //循环检测是否进入发布界面 baseAction.CircleDetection("PublishActivity", idleFishViewModel.Device, false); //发布宝贝页面 PublishPage(idleFishViewModel, wmPoint); }
/// <summary> /// 发布宝贝页面 /// </summary> public void PublishPage(IdleFishActionViewModel idleFishViewModel, WMPoint wmPoint) { var currentViewModel = idleFishViewModel; currentViewModel.XMLName = "publishactivity"; ///分析布局 Action <IdleFishActionViewModel, string, XmlDocument, Action <IdleFishActionViewModel, WMPoint> > func = (model, xmlSelectStr, doc, action) => { ///标题 XmlNode node = doc.SelectSingleNode(xmlSelectStr); var strValue = node.Attributes["bounds"].Value; var returnData = baseAction.GetStartBoundsWithEndBounds <IdleFishActionViewModel>(model, strValue); returnData.CurrentContent = returnData.Title; if (xmlSelectStr.Contains("content")) { returnData.CurrentContent = returnData.Description; } action(returnData, wmPoint); }; baseAction.CreatUIXML <IdleFishActionViewModel>(currentViewModel, (o, doc) => { ///标题 func(o, "//node[@resource-id='com.taobao.idlefish:id/title']", doc, TxtAction); ///描述 func(o, "//node[@resource-id='com.taobao.idlefish:id/content']", doc, TxtAction); ///价格 func(o, "//node[@resource-id='com.taobao.idlefish:id/price']", doc, PriceAction); //分类 func(o, "//node[@resource-id='com.taobao.idlefish:id/cate_name']", doc, CategoryAction); //确认发布按钮 func(o, "//node[@resource-id='com.taobao.idlefish:id/publish_button']", doc, ClickAction); return(o); }); }