public void LoginIn() { string UserName = Request["txt_account"]; //获取输入的用户名 string UserPwd = Request["txt_password"]; //获取输入的密码 BmobUser user = new BmobUser(); BmobWindows bmob = new BmobWindows(); bmob.Login <BmobUser>(UserName, UserPwd, (resp, exception) => { if (exception != null) { Debug.WriteLine("登录失败, 失败原因为: " + exception.Message); return; } Response.Write("<script>window.location.href='https://www.baidu.com/'</script>"); Debug.WriteLine("登录成功, 当前用户对象Session: " + BmobUser.CurrentUser.sessionToken); }); //try //{ // if (UserName == "admin") // return Content(new AjaxResult { state = ResultType.success.ToString(), message = "登录成功。" }.ToJson()); // else if (UserPwd == "123456") // return Content(new AjaxResult { state = ResultType.success.ToString(), message = "登录成功。" }.ToJson()); // else // return Content(new AjaxResult { state = ResultType.error.ToString(), message = "请验证帐号及密码!" }.ToJson()); //} //catch (Exception ex) //{ // return Content(new AjaxResult { state = ResultType.error.ToString(), message = ex.Message }.ToJson()); //} }
public BmobBaseForm() : base() { bmob = new BmobWindows(); Bmob.initialize("f69acbf2dd96fbaefdf9fd9793e93f66", "9a956445ff932b7d3f59b81af28cbe2a "); BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }
public CommPresenter(ICloudServiceView view) { _view = view; _cloudServiceHelper = new CloudServiceHelper(this); _bmobWindows = _cloudServiceHelper.BmobBuilder(); initTimer(); }
public void processReceivedData(byte[] replyData) { string msg = Encoding.ASCII.GetString(replyData); if (msg.Length == 7 && msg.Substring(0, 1).Equals("t")) { BmobWindows bmobWindows = CloudServiceHelper.BmobBuilder(); int lowValue = int.Parse(msg.Substring(1, 2)); int highValue = int.Parse(msg.Substring(4, 2)); int value = (lowValue + highValue) / 2; bool humid = msg.Substring(6, 1).Equals("s") ? true : false; KyOperation kyOperation = new KyOperation(value, humid); kyOperation.objectId = "429af4fea3"; bmobWindows.UpdateTaskAsync(kyOperation); KyCommand command = new KyCommand(); bmobWindows.Get <KyCommand>("KyCommand", "6402c5a401", (result, ex) => { if (ex == null) { if (result.isOpenedLed.Get()) { _tcpClient.Send("opled"); result.isOpenedLed = false; bmobWindows.UpdateTaskAsync(result); } } }); } }
public void stopCloudData() { KyOperation kyOperation = new KyOperation(); kyOperation.isOpened = false; kyOperation.objectId = "429af4fea3"; BmobWindows bmobWindows = CloudServiceHelper.BmobBuilder(); bmobWindows.UpdateTaskAsync(kyOperation); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BmobWindows Bmob = new BmobWindows(); Bmob.initialize("69e01e36e091bee65ebeb8f93604f474", "8b0d500c09ff5c86cfcd3358b5104b05"); BmobDebug.Register(msg => { Debug.WriteLine(msg); }); //注册调试工具 }
/// <summary> /// Bmob初始化 /// </summary> public BmobWindows BmobBuilder() { if (_bmobWindows == null) { _bmobWindows = new BmobWindows(); _bmobWindows.initialize(PresetInfo.BmobApplicationId, PresetInfo.BmobRestApiKey); BmobDebug.Register(msg => { Debug.WriteLine("BmobDebug:" + msg); }); } return(_bmobWindows); }
public BmobBasePCForm() : base() { bmob = new BmobWindows(); _toolTip = new ToolTip(); //初始化ApplicationId,这个ApplicationId需要更改为你自己的ApplicationId( http://www.bmob.cn 上注册登录之后,创建应用可获取到ApplicationId) Bmob.initialize("f8e94fde865de2270860606c30e4cdaa", "a586925dc4857f8f598ca6edbee17894"); //注册调试工具 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }
public BmobBaseForm() : base() { bmob = new BmobWindows(); //初始化ApplicationId,这个ApplicationId需要更改为你自己的ApplicationId( http://www.bmob.cn 上注册登录之后,创建应用可获取到ApplicationId) Bmob.initialize("4414150cb439afdf684d37dc184e0f9f", "e1deb317442129c125b228ddf78e5f22"); //注册调试工具 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }
public BmobInitializer() : base() { bmob = new BmobWindows(); //初始化,这个ApplicationId/RestKey需要更改为你自己的ApplicationId/RestKey( http://www.bmob.cn 上注册登录之后,创建应用可获取到ApplicationId/RestKey) Bmob.initialize("69e01e36e091bee65ebeb8f93604f474", "8b0d500c09ff5c86cfcd3358b5104b05"); //注册调试工具 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }
public BmobBaseForm() : base() { bmob = new BmobWindows(); //初始化ApplicationId,这个ApplicationId需要更改为你自己的ApplicationId( http://www.bmob.cn 上注册登录之后,创建应用可获取到ApplicationId) Bmob.initialize("69015a79796397f7701454336b84e0c4"); //注册调试工具 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }
public BmobBaseForm() : base() { InitializeComponent(); bmob = new BmobWindows(); //初始化ApplicationId,这个ApplicationId需要更改为你自己的ApplicationId( http://www.bmob.cn 上注册登录之后,创建应用可获取到ApplicationId) Bmob.initialize("5fcf8cca1113b5136fca2007de03892d", ""); //注册调试工具 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }
private void DataTimer_Tick(object sender, EventArgs e) { Console.WriteLine("定时器"); BmobWindows bmobWindows = CloudServiceHelper.BmobBuilder(); bmobWindows.Get <CloudControl>("CloudControl", "W2obDDDL", (result, ex) => { if (ex == null) { if (result.deployCollectOpened.Get()) { PresetInfo.StartAutoCollect = true; if (!isWorking) { isWorking = true; _commPresenter.DeviceGatherStart(OperateType.Gather); } CloudControl cloudControl = new CloudControl(); cloudControl.objectId = "W2obDDDL"; cloudControl.cloudCollectOpened = true; if (currentCollectNum == 0) { cloudControl.cloudCollectProgress = 0; } else { int value = currentCollectNum * 100 / currentCollectSumNum; cloudControl.cloudCollectProgress = value; Console.WriteLine("当前进度:" + value); } bmobWindows.UpdateTaskAsync(cloudControl); Console.WriteLine("数据发送完毕"); } else { PresetInfo.StartAutoCollect = false; isWorking = false; } } }); }
public BmobToolClass() { bmob = new BmobWindows(); Bmob.initialize("278382c756ccf9a0c7d461054b9cff45", "e08b0f700b424129448c19c4160048e2"); }
private BmobIntance() { Bmob = new BmobWindows(); }
/// <summary> /// 实例化日志查询 /// </summary> /// <param name="tableName">表名</param> /// <param name="appKey">Application Key</param> /// <param name="restKey">REST Key</param> public LogQuery(string tableName, string appKey, string restKey) { this._tableName = tableName; this._bmob = new BmobWindows(); this._bmob.initialize(appKey, restKey); }
private Bmob_Initial() : base() { bmob = new BmobWindows(); //初始化,这个ApplicationId/RestKey需要更改为你自己的ApplicationId/RestKey( http://www.bmob.cn 上注册登录之后,创建应用可获取到ApplicationId/RestKey) Bmob.initialize("bcab92606ca5634cc0a65811ee7940f7", "f23363d3111faa6d14ba23d510a521f7"); }
/// <summary> /// 初始化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnInit_Click(object sender, EventArgs e) { BmobWindows Bmob = new BmobWindows(); Bmob.initialize("38cd909fe640756176303b980453db55", "9e8a836ccfd013f87619b284a97de02c"); // 初始化Bmob客户端 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); // 用于调试输出请求参数 BmobQuery query = new BmobQuery(); //新建查询 查询Activityrecord表中所有的数据 按时间正向排序 Bmob.Find <ReadFile>("Activityrecord", query, (resp, exception) => { // 处理查询网络异常 if (exception != null) { return; } //对返回结果进行处理 List <ReadFile> list = resp.results; foreach (var game in list) { BmobFile record = game.record; if (record != null) { if (File.Exists(record.filename)) { Console.WriteLine("跳过:" + record.filename); } else { Console.WriteLine("下载:" + record.filename); //调用HttpDownload进行非重复文件的下载,此处下载为同步下载 即一个下载完才会执行之后代码 HttpDownload(record.url, "./" + record.filename); } } } Console.WriteLine("开始写入"); String[] files = Directory.GetFiles("./", "*.txt", SearchOption.AllDirectories); foreach (string f in files) { if (File.Exists("db.txt")) { Console.WriteLine("it is existed"); } else { FileStream fs = new FileStream("db.txt", FileMode.CreateNew); fs.Close(); } Console.WriteLine("查看" + f); if (f.Contains("db.txt")) { continue; } string a = System.IO.File.ReadAllText(f); string b = System.IO.File.ReadAllText("db.txt"); System.IO.File.WriteAllText("db.txt", a + "\r\n" + b); File.Delete(f); } byte[] byData = new byte[100]; char[] charData = new char[1000]; // 这里是Bmob的回调函数 也就是查询完之后执行下载了所有文件再执行此处的合并和InitChart // 所以需要将这个设置为False 否则会提示操作跨线程错误 Control.CheckForIllegalCrossThreadCalls = false; InitChart(); Read("db.txt"); }); }