public override ReturnData GetRecentInfo() { ReturnData PreparedInfo = new ReturnData() { reply_code = (ReplyCodeMeaning)UserConfig.reply_code, reply_msg = UserConfig.reply_msg, ReturnCodeMeaning = CodeMeaningTranslate((ReplyCodeMeaning)UserConfig.reply_code) }; if (PreparedInfo.ReturnCodeMeaning == ReturnDataCodeMeaning.Success) { PreparedInfo.Bills = UserConfig.rows; } return(PreparedInfo); }
public override ReturnData GetRecentInfo() { ReturnData PreparedInfo = new ReturnData() { reply_code = (ReplyCodeMeaning)UserConfig.reply_code, reply_msg = UserConfig.reply_msg, ReturnCodeMeaning = CodeMeaningTranslate((ReplyCodeMeaning)UserConfig.reply_code) }; if (PreparedInfo.ReturnCodeMeaning == ReturnDataCodeMeaning.Success) { PreparedInfo.month = UserConfig.rows[0].month; PreparedInfo.onlineSeconds = UserConfig.rows[0].total_ipv4_volume; PreparedInfo.onlineTimeSpan = new TimeSpan(0, 0, (int)PreparedInfo.onlineSeconds); PreparedInfo.onlineTime = OnlineTime2String(PreparedInfo.onlineTimeSpan); } return(PreparedInfo); }
public async Task <bool> RunConcreteUser(GetJSON which, bool set_as_User = false) { if (which == null) { return(false); } else { Debug.WriteLine("开始执行对于" + which.DestPage.ToString() + "的任务"); if (set_as_User) { SetConcreteUser(which); } bool Hresult = await which.RunSession(); ReturnData HArgs = which.GetRecentInfo(); Debug.WriteLine("|" + which.DestPage.ToString() + "刷新显示内容"); RunReturnDataEvent(which.DestPage, Hresult, HArgs); Debug.WriteLine("|" + which.DestPage.ToString() + "结束"); return(Hresult); } }
public override ReturnData GetRecentInfo() { ReturnData PreparedInfo = new ReturnData() { reply_code = (ReplyCodeMeaning)UserConfig.reply_code, reply_msg = UserConfig.reply_msg, ReturnCodeMeaning = CodeMeaningTranslate((ReplyCodeMeaning)UserConfig.reply_code) }; if (PreparedInfo.ReturnCodeMeaning == ReturnDataCodeMeaning.Success) { PreparedInfo.Notices = new List <NoticeContent>(); for (int i = 0; i < UserConfig.total; ++i) { NoticeContent tmp = new NoticeContent() { time = DistTime2String(UserConfig.notice[i].disttime), title = UserConfig.notice[i].title, url = UserConfig.notice[i].url }; PreparedInfo.Notices.Add(tmp); } } return(PreparedInfo); }
public override ReturnData GetRecentInfo() { ReturnData PreparedInfo = new ReturnData() { reply_code = (ReplyCodeMeaning)UserConfig.reply_code, reply_msg = UserConfig.reply_msg, ReturnCodeMeaning = CodeMeaningTranslate((ReplyCodeMeaning)UserConfig.reply_code) }; if (PreparedInfo.ReturnCodeMeaning == ReturnDataCodeMeaning.Success) { PreparedInfo.acctstarttime = UserConfig.userinfo.acctstarttime; PreparedInfo.area_name = UserConfig.userinfo.area_name; PreparedInfo.balance = (double)UserConfig.userinfo.balance / 100.0; PreparedInfo.fullname = UserConfig.userinfo.fullname; PreparedInfo.mac = UserConfig.userinfo.mac; PreparedInfo.service_name = UserConfig.userinfo.service_name; PreparedInfo.username = UserConfig.userinfo.username; PreparedInfo.useripv4 = EncryptUtil.ip2Str(UserConfig.userinfo.useripv4); PreparedInfo.useripv6 = UserConfig.userinfo.useripv6; } return(PreparedInfo); }
public void FindIfNewNotice(Pages PageType, bool Hresult, ReturnData HArgs) { if (PageType != Pages.GetNotice) { return; } if (HArgs.ReturnCodeMeaning != ReturnDataCodeMeaning.Success) { return; } Debug.WriteLine("|检查Notice是否有新的"); //比较通知是否有变化 var Recorder = new SettingSaver_Local(); string b_notice = ""; Recorder.GetRecordString(NameManager.LastTimeNotice, ref b_notice); if (UserConfig.notice == null) { Debug.WriteLine("|当前没有通知."); return; } if (b_notice != RecentInfo) { Recorder.AlterRecordString(NameManager.LastTimeNotice, RecentInfo); if (b_notice.Length == 0) { foreach (var m in UserConfig.notice) { Debug.WriteLine("|出现新通知,发送Notification."); SendNotification("于 " + DistTime2String(m.disttime), m.title, m.url); } } else { var serializer = new DataContractJsonSerializer(typeof(NoticeConfig)); var b_mStream = new MemoryStream(Encoding.UTF8.GetBytes(b_notice)); var b_UserConfig = (NoticeConfig)serializer.ReadObject(b_mStream); foreach (var m in UserConfig.notice) { bool HasThisNotice = false; foreach (var n in b_UserConfig.notice) { if (m.title == n.title && m.url == n.url && m.disttime == n.disttime) { HasThisNotice = true; break; } } if (HasThisNotice) { continue; } Debug.WriteLine("|出现新通知,发送Notification."); SendNotification("于 " + DistTime2String(m.disttime), m.title, m.url); } } } }
public async void EventAfterLoginAndUserInfoGetHandler(Pages PageType, bool Hresult, ReturnData HArgs) { if (HArgs.ReturnCodeMeaning == ReturnDataCodeMeaning.Success) { if (PageType == Pages.LoginPage || PageType == Pages.GetInfo) { balance = HArgs.balance; ServiceTypeIsDirectOut = HArgs.service_name == NameManager.DirectOutServiceName; await RunConcreteUser(Pages.GetVolume); //这里必须等待 } else if (PageType == Pages.GetVolume) //先后顺序一定是先info(or login)再volume的 { if (!ServiceTypeIsDirectOut) { BalanceCheck(balance, HArgs.onlineTimeSpan); } } } }
private void BillRefresh_ReturnDataEvent(LoggingSystem.Pages PageType, bool Hresult, LoggingSystem.ReturnData HArgs) { if (PageType == Pages.GetBill) { switch (HArgs.ReturnCodeMeaning) { case ReturnDataCodeMeaning.Success: PointsSource.Clear(); foreach (var m in HArgs.Bills) { var X = m.enddate; var Y = ((double)m.ending_balance / 1000); PointsSource.Add(new Point() { X = X, Y = Y }); } PointChart.PointsSource = PointsSource; RefreshContentInTable(HArgs.Bills); break; case ReturnDataCodeMeaning.Fail: case ReturnDataCodeMeaning.NoNetWork: PointChart.Background = new SolidColorBrush(Colors.Crimson); break; } } }
protected void LoginInfoDataHandler(Pages PageType, bool Hresult, ReturnData HArgs) { // code here }