private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { UpdateProgress uiUpdater = new UpdateProgress(DisplayClientMessage); UpdateProgress uiUpdater1 = new UpdateProgress(DisplayMsBuildLogMessage); string msgArgsStr; MessageArgsLogger messageArgs; while (true) { if (messagesToBeDisplayed.Count > 0) { bool isDequeued = messagesToBeDisplayed.TryDequeue(out msgArgsStr); if (isDequeued) { messageArgs = (MessageArgsLogger)ATACore.CommandExecutor.MessageDeserializer(msgArgsStr, typeof(MessageArgsLogger)); switch (messageArgs.MessageSource) { case MessageSource.MsBuildLogger: this.Invoke(uiUpdater1, messageArgs.LogMessage); break; case MessageSource.EnqueueLogger: case MessageSource.DenqueueLogger: case MessageSource.ExecutionLogger: this.Invoke(uiUpdater, messageArgs.LogMessage); break; } } } } }
private static IEnumerator LoadOperations(List <ISceneLoadAsyncOperation> operations, int numOperations) { var currentOperation = 0f; // loop through all the unload operations foreach (var unloadOperation in operations) { // run the operation and don't yield it unloadOperation.Operation().Run(); // get the progress of the unload operation var progress = unloadOperation.GetProgress(); // while the progress isn't done while (progress < 1) { // send an event telling anything that's listening how far through the unload process we are // divide by two, add 0.5 because unloading is the first part of the sequence - we want a number between 0 and 0.5 UpdateProgress?.Invoke(GetOperationListProgress(progress, currentOperation, numOperations) / 2 + 0.5f); // update the progress progress = unloadOperation.GetProgress(); yield return(null); } // we're done with this operation, onto the next one! ++currentOperation; } }
private void LoadUpdatePanel() { AJAX.RegisterScriptManager(); ScriptManager scriptManager = AJAX.GetScriptManager(this.Page); if (scriptManager != null) { scriptManager.EnablePartialRendering = true; } UpdatePanel updatePanel = new UpdatePanel(); updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional; updatePanel.ID = _Control.ID + "_UP"; Control objContentTemplateContainer = updatePanel.ContentTemplateContainer; InjectMessageControl(objContentTemplateContainer); objContentTemplateContainer.Controls.Add(_Control); InjectModuleContent(updatePanel); System.Web.UI.WebControls.Image objImage = new System.Web.UI.WebControls.Image(); objImage.ImageUrl = "~/images/progressbar.gif"; objImage.AlternateText = "ProgressBar"; UpdateProgress updateProgress = new UpdateProgress(); updateProgress.AssociatedUpdatePanelID = updatePanel.ID; updateProgress.ID = updatePanel.ID + "_Prog"; updateProgress.ProgressTemplate = new UI.WebControls.LiteralTemplate(objImage); this.Controls.Add(updateProgress); }
private void updateProgres() { while (true) { TimeSpan currTime = TimeSpan.FromMilliseconds(CurrentPosition); TimeSpan leftTime = TimeSpan.FromMilliseconds(Duration - CurrentPosition); var CurrentPositionSec = currTime.ToString(@"m\:ss"); var LeftProgressSec = string.Format("-{0}", leftTime.ToString(@"m\:ss")); double currentPosition = CurrentPosition; double duration = Duration; var args = new PlayerArgs { CurrentPositionSec = currTime.ToString(@"m\:ss"), LeftProgressSec = string.Format("-{0}", leftTime.ToString(@"m\:ss")), ProgressDegree = currentPosition / duration }; UpdateProgress?.Invoke(this, args); Thread.Sleep(1000); } }
protected override IEnumerable <ScriptDescriptor> GetScriptDescriptors(Control targetControl) { ScriptBehaviorDescriptor descriptor = new ScriptBehaviorDescriptor("TicketDesk.Engine.Ajax.Extenders.UpdateProgressOverlayBehavior", targetControl.ClientID); UpdateProgress up = targetControl as UpdateProgress; string asscUpdatePanelClientId = string.IsNullOrEmpty(up.AssociatedUpdatePanelID) ? null : GetClientId(up.AssociatedUpdatePanelID, "AssociatedUpdatePanelID"); string controlToOverlayID = null; if (_overlayType != OverlayType.Browser) { controlToOverlayID = string.IsNullOrEmpty(ControlToOverlayID) ? asscUpdatePanelClientId : GetClientId(ControlToOverlayID, "ControlToOverlayID"); } descriptor.AddProperty("controlToOverlayID", controlToOverlayID); descriptor.AddProperty("associatedUpdatePanelID", asscUpdatePanelClientId); descriptor.AddProperty("displayAfter", up.DisplayAfter); descriptor.AddProperty("targetCssClass", this.CssClass); descriptor.AddProperty("centerOnContainer", this.CenterOnContainer); descriptor.AddProperty("elementToCenterID", this.ElementToCenterID); return(new ScriptDescriptor[] { descriptor }); }
private void btnConnect_Click(object sender, RoutedEventArgs e) { //TestGetIpsInformation(); GetIpsInformation(); //backgroundWorker2.RunWorkerAsync(); lock (this) { // Waits until the listener in the backgroundworker2 is initialized Monitor.Wait(this); } UpdateProgress uiUpdater = new UpdateProgress(DisplayClientMessage); { clientTcpWriter = new TcpClient(); clientTcpListner = new TcpClient(); lock (this) { clientTcpWriter.Connect(agentSettings.IpString, clientSettings.Port); Thread.Sleep(2000); clientTcpListner.Connect(agentSettings.IpString, clientSettings.Port); } isConnected = true; tbMainLog.Text = "Client Socket Program - Server Connected ..."; //backgroundWorker1.RunWorkerAsync(); } }
public object Run(int timeSleep = 100) { for (int i = 0; i < 100; i++) { while (IsPaused) { Thread.Sleep(100); } if (CancelToken.IsCancellationRequested) { return(null); } UpdateProgress?.Invoke(this, new ProgressArg(i, 100, CancelFlag)); Debug.WriteLine(i); UpdateStatus?.Invoke(this, new StateArg($"File {i}", CancelFlag)); // db2.CurrentOP = $"{DxTBLang.File} {i}"; Thread.Sleep(timeSleep); } UpdateProgress?.Invoke(this, new ProgressArg(100, 100, CancelFlag)); //db2.AsyncClose(); return(null); }
static void ShowUpdateReportDialog( WorkspaceInfo wkInfo, ViewHost viewHost, UpdateProgress progress, IProgressControls progressControls, GuiMessage.IGuiMessage guiMessage, IUpdateProgress updateProgress, IGluonUpdateReport updateReport) { if (progress.ErrorMessages.Count == 0) { return; } UpdateReportResult updateReportResult = updateReport.ShowUpdateReport(wkInfo, progress.ErrorMessages); if (!updateReportResult.IsUpdateForcedRequested()) { return; } UpdateForcedOperation updateForced = new UpdateForcedOperation( wkInfo, viewHost, progress, progressControls, guiMessage, updateProgress, updateReport); updateForced.UpdateForced( updateReportResult.UpdateForcedPaths, updateReportResult.UnaffectedErrors); }
private static void GetProgressAndUpdate(System.Diagnostics.Process p, UpdateProgress updateProgress, out long totalTime) { var errorStream = p.StandardError; totalTime = 0; while (!errorStream.EndOfStream) { var line = errorStream.ReadLine(); if (line.Contains("Duration:")) { var durationKeyAndValue = line.Split(new char[] { ',' })[0]; var durationValue = durationKeyAndValue.Substring(durationKeyAndValue.IndexOf(':') + 1); TimeSpan duration; TimeSpan.TryParse(durationValue, out duration); totalTime = Convert.ToInt64(duration.TotalSeconds); } else if (line.Contains("time=")) { var timeSubstring = line.Substring(line.IndexOf("time=")); var timeKeyAndValue = timeSubstring.Substring(0, timeSubstring.IndexOf(' ')); var timeValueWithFractions = timeKeyAndValue.Split(new char[] { '=' })[1]; var timeValue = Math.Floor(Convert.ToDouble(timeValueWithFractions) + 0.5); var currentTime = Convert.ToInt64(timeValue); updateProgress(currentTime, totalTime); } } }
public void Initialize() { Logger.Info("Update context initializing..."); Logger.Info("Update context points to {RemoteUrl}", Settings.RemoteUrl); _progress = new UpdateProgress(); SetCurrentVersion(); var cleanedFiles = CleanWorkspace(); Logger.Info("Workspace cleaned. Removed {CleanedFiles} files", cleanedFiles); Task.WaitAll( GetUpdaterDefinition(), GetBuildsIndex(), GetPatchesIndex() ); Task.WaitAll( GetLocalFiles(), GetBuildDefinition() ); Task.WaitAll(GetPatchesShortestPath()); _progress.TotalSteps = Runner.GetProgressAmount(); Logger.Info("Update context completed initialization."); }
private void GetFiles(string filePath, ScanMode mode) { try { foreach (string str in System.IO.Directory.GetFiles(filePath)) { System.IO.FileInfo fi = new System.IO.FileInfo(str); if (!this.itemsList.Contains(fi.Extension.ToUpper())) { continue; } if (mode == ScanMode.AnalyseDirectoryStructure) { this.analyseFileCount += 1; UpdateFiles?.Invoke(this.analyseFileCount.ToString()); } else { this.scanFileCount += 1; UpdateFiles?.Invoke(this.scanFileCount + " of " + this.analyseFileCount); UpdateProgress?.Invoke(Convert.ToInt32((this.scanFileCount / (double)this.analyseFileCount) * 100)); ScanFile(str); } } } catch (UnauthorizedAccessException ex) { } }
private void backgroundWorker2_DoWork() { lock (this) { IPAddress ipAddress = clientSettings.GetIPAddress(); serverMsBuildUpdaterListener = new TcpListener(ipAddress, agentSettings.Port); // Gives a Signal to the initial thread that the agent client Listener is initialized Monitor.Pulse(this); } UpdateProgress uiUpdater1 = new UpdateProgress(DisplayClientMessage); serverMsBuildUpdaterListener.Start(); clientMsBuildTcpAgentListner = default(TcpClient); clientMsBuildTcpAgentListner = serverMsBuildUpdaterListener.AcceptTcpClient(); // Will update the status of the agents execution (MS Build Log) until the client is connected with the agent. UpdateProgress uiUpdater = new UpdateProgress(DisplayMsBuildLogMessage); while (isConnected) { NetworkStream serverStream = clientMsBuildTcpAgentListner.GetStream(); byte[] inStream = new byte[10025]; serverStream.Read(inStream, 0, (int)clientMsBuildTcpAgentListner.ReceiveBufferSize); string returndata = System.Text.Encoding.ASCII.GetString(inStream); if (returndata != String.Empty) { this.Dispatcher.BeginInvoke(uiUpdater, returndata); //this.Invoke(uiUpdater, returndata); } } }
public static void DownloadFile(string url, string fileName, UpdateProgress updateProgress) { // used to build entire input var fileStream = File.Create(fileName); // used on each read operation var buffer = new byte[8192]; var request = WebRequest.Create(url) as HttpWebRequest; request.UserAgent = CHROME_USER_AGENT; var response = request.GetResponse() as HttpWebResponse; var contentLength = response.ContentLength; var responseStream = response.GetResponseStream(); int readBufferLength; do { readBufferLength = responseStream.Read(buffer, 0, buffer.Length); fileStream.Write(buffer, 0, readBufferLength); updateProgress(fileStream.Length, contentLength); } while (readBufferLength > 0); fileStream.Close(); }
/* * id=1 * dish_name=asdfasdfere * charge_sum=123 * is_vege=PURE * is_idle=false * daily_limit=1000 */ public void Upload(UpdateProgress invoker) { List <Dictionary <string, string> > suffix = new List <Dictionary <string, string> >(); List <List <string> > data = excel.GetRow(); foreach (List <string> row in data) { string id = row[0]; if (!id.All(char.IsDigit)) { continue; } string dname = row[1]; string charge = row[2]; string vege = (row[3] == "葷" ? "MEAT" : "PURE"); string idle = (row[4] == "是" ? "true" : "false"); string limit = row[5]; suffix.Add(new Dictionary <string, string> { { "id", WebUtility_Extend.UrlEncode(id) }, { "dish_name", WebUtility_Extend.UrlEncode(dname) }, { "charge_sum", WebUtility_Extend.UrlEncode(charge) }, { "is_vege", WebUtility_Extend.UrlEncode(vege) }, { "is_idle", WebUtility_Extend.UrlEncode(idle) }, { "daily_limit", WebUtility_Extend.UrlEncode(limit) } }); } req.Update_Dish(suffix, invoker); }
private void DisplayMsBuildLog() { UpdateProgress uiUpdater = new UpdateProgress(DisplayClientMessage); while (true) { try { if (MainWindow.messagesToBeSend.Count > 0) { MessageArgsLogger msgArgs; bool isDequeued = MainWindow.messagesToBeSend.TryDequeue(out msgArgs); if (isDequeued) { rtbStatus.Dispatcher.BeginInvoke(uiUpdater, DispatcherPriority.Normal, msgArgs.LogMessage); Thread.Sleep(50); } } } catch (Exception ex) { break; } } }
public static Control CreateUpdateProgressControl(string AssociatedUpdatePanelID) { var updateProgress = new UpdateProgress(); updateProgress.ID = AssociatedUpdatePanelID + "_Prog"; updateProgress.AssociatedUpdatePanelID = AssociatedUpdatePanelID; return updateProgress; }
private void updateProgress(int value) { if (UpdateProgress != null) { UpdateProgress.Invoke(this, new ObjectEventArgs <int>(value)); } }
public async static Task GetMenuAsync(UpdateProgress progressListener) { bool Exists = await LoadFile(); progressListener?.Invoke(0, "파일 불러오는 중...", true); if (!Exists) { progressListener?.Invoke(0, "데이터 가져오는 중...", true); foreach (FoodData.Type type in FoodTypes) { if (type == FoodData.Type.UNDIFINED) { continue; } await ParseHTML(type); } progressListener?.Invoke(0, "데이터 저장 중...", true); WriteToXml(Cates); } progressListener?.Invoke(0, "메뉴 불러오는 중...", true); await LoadMenu(progressListener); }
/* * id=1 * dish_name=asdfasdfere * charge_sum=123 * is_vege=PURE * is_idle=false * daily_limit=1000 */ public void Upload(UpdateProgress invoker) { List <string> suffix = new List <string>(); List <List <string> > data = excel.GetRow(); foreach (List <string> row in data) { string id = row[0]; if (!id.All(char.IsDigit)) { continue; } string dname = row[1]; string charge = row[2]; string vege = (row[3] == "葷" ? "MEAT" : "PURE"); string idle = (row[4] == "是" ? "true" : "false"); string limit = row[5]; suffix.Add("&id=" + WebUtility.UrlEncode(id) + "&dish_name=" + WebUtility.UrlEncode(dname) + "&charge_sum=" + WebUtility.UrlEncode(charge) + "&is_vege=" + WebUtility.UrlEncode(vege) + "&is_idle=" + WebUtility.UrlEncode(idle) + "&daily_limit=" + WebUtility.UrlEncode(limit)); } req.Update_Dish(suffix, invoker); }
private bool Extractfiles(ZipFile archiveZ, IEnumerable <ZipEntry> files, string destFolder) { archiveZ.ExtractProgress += ArchiveZ_ExtractProgress; archiveZ.ZipError += ArchiveZ_ZipError; int max = files.Count(); UpdateStatus?.Invoke(this, new StateArg("Zip Decompression", CancelFlag)); UpdateProgress?.Invoke(this, new ProgressArg(0, 100, CancelFlag)); UpdateProgressT?.Invoke(this, new ProgressArg(0, max, CancelFlag)); int i = 0; foreach (var ze in files) { UpdateProgressT?.Invoke(this, new ProgressArg(i, 100, CancelFlag)); if (TokenSource != null && TokenSource.IsCancellationRequested) { return(false); } //UpdateStatus?.Invoke(this, $"\tZipExtraction: {ze.FileName}"); ze.Extract(destFolder, ExtractExistingFileAction.OverwriteSilently); i++; } UpdateProgressT?.Invoke(this, new ProgressArg(max, max, CancelFlag)); return(true); }
private async static Task LoadMenu(UpdateProgress progress) { var input = await xmlFile.OpenReadAsync(); XmlTextReader xmlTextReader = new XmlTextReader(input.AsStreamForRead()); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(xmlTextReader); XmlNode menuNode = xmlDocument.SelectSingleNode("Menu"); int foodMax = GetAllFoodsCount(menuNode); int foodCount = 0; for (int indexCate = 0; indexCate < menuNode.SelectNodes("Cate").Count; indexCate++) { XmlNode cateNode = menuNode.SelectNodes("Cate")[indexCate]; FoodData.Type type = FoodData.ParseType(cateNode.Attributes["id"].Value); for (int indexFood = 0; indexFood < cateNode.SelectNodes("Food").Count; indexFood++) { XmlNode foodNode = cateNode.SelectNodes("Food")[indexFood]; if (foodNode.SelectSingleNode("EAN") == null) { FoodDatas.Add(await new FoodData(type, foodNode.Attributes["name"].Value, int.Parse(foodNode.SelectSingleNode("Price").InnerText), 0, new Uri(foodNode.SelectSingleNode("Url").InnerText)).PreloadImage(indexCate, foodCount, menuNode.ChildNodes.Count, foodMax, progress)); } else { FoodDatas.Add(await new FoodData(type, foodNode.Attributes["name"].Value, foodNode.SelectSingleNode("EAN").InnerText, int.Parse(foodNode.SelectSingleNode("Price").InnerText), 0, new Uri(foodNode.SelectSingleNode("Url").InnerText)).PreloadImage(indexCate, foodCount, menuNode.ChildNodes.Count, foodMax, progress)); } foodCount++; } } InitLists(); }
private static void TranslateUpdateProgress(UpdateProgress obj) { if (obj != null) { ObjectIdentify(obj.Controls); } }
/* Player picks up the key */ private void OnTriggerEnter(Collider coll) { //coll = GetComponent<Collider> (); if (coll.gameObject == player) { playClip = true; if (clock == null && GetComponent <Timer> () != null) { clock = GetComponent <Timer> (); } currentLevel = SceneManager.GetActiveScene().name; //attempts = handler.getAttempts (); timeToComplete = (int)clock.getTotalSeconds(); string path = currentLevel + ".Attempts.KeysCollected.Time"; UpdateProgress.ProgressUpdate(path, attempts, timeToComplete); GetPlayerData.GetData(attempts, timeToComplete, 1); // DoBeep(); diamond.SetActive(false); print("Key has been picked up 1"); level2.displayPopUp(); } }
public static async Task Download(UpdateProgress change) { ulong currentSize = 0; // Replace existed file const string fileName = "DistrictData.json"; var newLibraryFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); Uri downloadUri = new Uri("http://postcodexian.cloudapp.net//MainService.svc/DownloadNewLibrary"); using (HttpClient downloadClient = new HttpClient()) { HttpResponseMessage responseMessage = await downloadClient.GetAsync(downloadUri); responseMessage.EnsureSuccessStatusCode(); string tempStr = String.Empty; byte[] buffer = new byte[100]; // Buffer using (var downloaded = await responseMessage.Content.ReadAsStreamAsync()) { int totalBytes = (int)downloaded.Length; var readBytes = downloaded.Read(buffer, 0, buffer.Length); while(readBytes > 0) { await Task.Delay(200); // Simulated time delay tempStr += Encoding.UTF8.GetString(buffer, 0, readBytes); currentSize += (ulong)readBytes; change(((int)currentSize * 100 / totalBytes)); readBytes = downloaded.Read(buffer, 0, readBytes); } await FileIO.WriteTextAsync(newLibraryFile, tempStr); downloaded.Flush(); } } }
protected override void CreateChildControls() { //Create the update panel mainUpdatePanel = new UpdatePanel(); mainUpdatePanel.ID = "updateAjaxDemoWebPart"; //Use conditional mode so that only controls within this panel cause an update mainUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional; //Create the update progress control progressControl = new UpdateProgress(); progressControl.AssociatedUpdatePanelID = "updateAjaxDemoWebPart"; //The class used for the progrss template is defined below in this code file progressControl.ProgressTemplate = new ProgressTemplate(ImagePath, DisplayText); //Create the Check Time button checkTimeButton = new Button(); checkTimeButton.ID = "checkTimeButton"; checkTimeButton.Text = "Check Time"; checkTimeButton.Click += new EventHandler(checkTimeButton_Click); //Create the label that displays the time timeDisplayLabel = new Label(); timeDisplayLabel.ID = "timeDisplayLabel"; timeDisplayLabel.Text = string.Format("The time is: {0}", DateTime.Now.ToLongTimeString()); //Add the button and label to the Update Panel mainUpdatePanel.ContentTemplateContainer.Controls.Add(timeDisplayLabel); mainUpdatePanel.ContentTemplateContainer.Controls.Add(checkTimeButton); //Add the Update Panel and the progress control to the Web Part controls this.Controls.Add(mainUpdatePanel); this.Controls.Add(progressControl); }
public static void InitTimer(UpdateProgress progress) { //ti = new System.Windows.Forms.Timer(); ti = new Timer(); //ti.Elapsed += new ElapsedEventHandler(progress); ti.Tick += new EventHandler(progress); ti.Interval = 3000; // in miliseconds }
private void AddUpdateProgress(Panel p) { this.updateProgress = new UpdateProgress(); this.updateProgress.ID = "ScrudUpdateProgress"; this.updateProgress.ProgressTemplate = new AjaxProgressTemplate(this.GetUpdateProgressTemplateCssClass(), this.GetUpdateProgressSpinnerImageCssClass(), this.Page.ResolveUrl(this.GetUpdateProgressSpinnerImagePath())); p.Controls.Add(this.updateProgress); }
public static Control CreateUpdateProgressControl(string AssociatedUpdatePanelID, Control ProgressControl) { var updateProgress = new UpdateProgress(); updateProgress.ID = AssociatedUpdatePanelID + "_Prog"; updateProgress.AssociatedUpdatePanelID = AssociatedUpdatePanelID; updateProgress.ProgressTemplate = new LiteralTemplate(ProgressControl); return updateProgress; }
/// <summary> /// Stop monitoring a process /// </summary> public void EndMonitoring() { if (monitor.IsBusy) { monitor.CancelAsync(); _updateProgress = null; } }
private void menu_Click(object sender, EventArgs e) { void original() { Menu.Enabled = true; Menu_Progress_Show.Text = "目前進度:0%"; Menu_Progress.Value = 0; } Menu.Enabled = false; Compatible_Extend.Task_Extend.Run(() => { try { template.Non_Override_Download(menu_file.Text); ExcelStream excel = new ExcelStream(menu_file.Text, sender.Equals(download_menu)); Update_Menu menu_update = new Update_Menu(req, excel); UpdateProgress progress = new UpdateProgress((int value) => { Invoke((MethodInvoker)(() => { Menu_Progress.Value = value; Menu_Progress_Show.Text = "目前進度:" + value.ToString() + "%"; })); }); if (sender.Equals(download_menu)) { menu_update.Download(progress); } else { menu_update.Upload(progress); } excel.Close(); if (sender.Equals(download_menu)) { Process.Start(menu_file.Text); } Invoke((MethodInvoker)(() => { original(); if (sender.Equals(upload_menu)) { MessageBox.Show("上載完成"); } })); } catch (Exception ex) { req.Report_Error(ex.ToString()); Invoke((MethodInvoker)(() => { original(); Error_Report.Text += ex.Message + "\r\n ----------- \r\n"; })); } }); }
internal void PartialUpdateWorkspace() { mProgressControls.ShowProgress(PlasticLocalization.GetString( PlasticLocalization.Name.UpdatingWorkspace)); ((IUpdateProgress)mGluonProgressOperationHandler).ShowCancelableProgress(); OutOfDateUpdater outOfDateUpdater = new OutOfDateUpdater(mWkInfo); IThreadWaiter waiter = ThreadWaiter.GetWaiter(); waiter.Execute( /*threadOperationDelegate*/ delegate { outOfDateUpdater.Execute(); }, /*afterOperationDelegate*/ delegate { mProgressControls.HideProgress(); ((IUpdateProgress)mGluonProgressOperationHandler).EndProgress(); mViewHost.RefreshView(ViewType.CheckinView); mViewHost.RefreshView(ViewType.IncomingChangesView); Refresh.UnityAssetDatabase(); if (waiter.Exception != null) { ExceptionsHandler.DisplayException(waiter.Exception); return; } ShowUpdateReportDialog( mWkInfo, mViewHost, outOfDateUpdater.Progress, mProgressControls, mGuiMessage, mGluonProgressOperationHandler, this); }, /*timerTickDelegate*/ delegate { UpdateProgress progress = outOfDateUpdater.Progress; if (progress == null) { return; } if (progress.IsCanceled) { mProgressControls.ShowNotification( PlasticLocalization.GetString(PlasticLocalization.Name.Canceling)); } ((IUpdateProgress)mGluonProgressOperationHandler).RefreshProgress( progress, UpdateProgressDataCalculator.CalculateProgressForWorkspaceUpdate( mWkInfo.ClientPath, progress)); }); }
public void Download(string l, string r, UpdateProgress invoker) { JArray orders = req.Get_Order(l.Replace("-", "/").Replace(" ", "-"), r.Replace("-", "/").Replace(" ", "-")); List <JToken> data = new List <JToken>(from token in orders orderby DateTime.Parse(token["recv_date"].ToString()) select token); JArray dish_respond = req.Get_Dish(); int counter = 5; Dictionary <int, int> did_to_cordinate = new Dictionary <int, int>(); foreach (JToken item in dish_respond) { if (item["department"]["factory"]["name"].ToString(Newtonsoft.Json.Formatting.None) != "\"" + req.uname + "\"") { continue; } if (item["is_idle"].ToString(Newtonsoft.Json.Formatting.None) == "\"1\"") { continue; } did_to_cordinate[item["dish_id"].ToObject <int>()] = counter; excel.Write(1, counter, item["dish_name"].ToString(Newtonsoft.Json.Formatting.None).Replace("\"", "")); counter += 1; } counter = 2; foreach (JToken item in data) { int[] sum = new int[1000]; foreach (JToken dish in item["dish"]) { sum[dish.ToObject <int>()] += 1; } excel.Write(counter, 1, counter - 1); excel.Write(counter, 2, item["user"]["seat_no"].ToString()); excel.Write(counter, 3, Regex.Match(item["recv_date"].ToString(), " [0-9]{2}:[0-9]{2}").Groups[0].ToString().Replace(" ", "")); excel.Write(counter, 4, item["money"]["charge"].ToString()); foreach (JToken dish in dish_respond) { if (dish["department"]["factory"]["name"].ToString(Newtonsoft.Json.Formatting.None) != "\"" + req.uname + "\"") { continue; } if (dish["is_idle"].ToString(Newtonsoft.Json.Formatting.None) == "\"1\"") { continue; } excel.Write(counter, did_to_cordinate[dish["dish_id"].ToObject <int>()], sum[dish["dish_id"].ToObject <int>()] == 0 ? "" : sum[dish["dish_id"].ToObject <int>()].ToString()); } counter += 1; invoker((int)Math.Ceiling((double)(counter - 2) / data.Count * 100)); } }
public static LocalVideoFile ConvertToVideoFile(LocalFlvFile flvFile, string outputFileName, UpdateProgress updateProgress) { var fileargs = "-i \"" + flvFile.FileName + "\" -y \"" + outputFileName + '"'; long totalTime; EncodeFile(fileargs, updateProgress, out totalTime); return new LocalVideoFile { FileName = outputFileName, TotalTime = totalTime }; }
public static void ImportAllAssets(UpdateProgress d) { var assets = AssetDatabase.FindAssets("") .Select(guid => AssetDatabase.GUIDToAssetPath(guid)) .Where(s => IsFont(s) || IsXaml(s)) .Distinct().ToArray(); NoesisPostprocessor.ImportAssets(assets, false, d); }
public BinSearchSuite(PredictionDataManager dataManager, IApplicationContext appContext, UpdateProgress updateProgress, ILTELinkLossCalculator linkloss) { this.m_DataManager = dataManager; this.m_AppContext = appContext; this.m_LinkLoss = linkloss; this.m_ThreadCount = dataManager.ThreadCount; this.m_UpdateProgress = updateProgress; this.GetNeedCalStudyCount(); this.m_ThreadList = new List<Thread>(); }
public Form1() { InitializeComponent(); mandelbrot = new Mandelbrot(); buffer = new Bitmap(Width, Height); graphics = this.CreateGraphics(); UpdateProgress update = new UpdateProgress(updateProgress); mandelbrot.PercentChanged += new EventHandler(update); }
private static void EncodeFile(string fileArguments, UpdateProgress updateProgress, out long totalTime) { var p = new System.Diagnostics.Process { StartInfo = { FileName = "ffmpeg.exe", Arguments = fileArguments, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true, } }; p.Start(); GetProgressAndUpdate(p, updateProgress, out totalTime); p.WaitForExit(); }
private void DisplayMsBuildLog() { UpdateProgress uiUpdater = new UpdateProgress(DisplayClientMessage); while (true) { try { if (MainWindow.messagesToBeSend.Count > 0) { MessageArgsLogger msgArgs; bool isDequeued = MainWindow.messagesToBeSend.TryDequeue(out msgArgs); if (isDequeued) { rtbStatus.Dispatcher.BeginInvoke(uiUpdater, DispatcherPriority.Normal, msgArgs.LogMessage); Thread.Sleep(50); } } } catch(Exception ex) { break; } } }
private void btnConnect_Click(object sender, EventArgs e) { //TestGetIpsInformation(); GetIpsInformation(); backgroundWorker2.RunWorkerAsync(); UpdateProgress uiUpdater = new UpdateProgress(DisplayClientMessage); clientTcpWriter = new TcpClient(); clientTcpListner = new TcpClient(); clientTcpWriter.Connect(agentSettings.IpString, clientSettings.Port); clientTcpListner.Connect(agentSettings.IpString, clientSettings.Port); isConnected = true; rtbMain.Text = "Client Socket Program - Server Connected ..."; backgroundWorker1.RunWorkerAsync(); }
private void DisplayMessages(CurrentExecutionViewModel CurrentExecutionViewModel) { UpdateProgress uiUpdaterExecution = new UpdateProgress(DisplayExecutionMessage); UpdateProgress uiUpdaterMsBuild = new UpdateProgress(DisplayMsBuildMessage); string msgArgsStr; MessageArgsLogger messageArgs; while (true) { if (CurrentExecutionViewModel.MessagesToBeDisplayed.Count > 0) { bool isDequeued = CurrentExecutionViewModel.MessagesToBeDisplayed.TryDequeue(out msgArgsStr); if (isDequeued) { messageArgs = (MessageArgsLogger)ATACore.CommandExecutor.MessageDeserializer(msgArgsStr, typeof(MessageArgsLogger)); switch (messageArgs.MessageSource) { case MessageSource.MsBuildLogger: rtbMsBuild.Dispatcher.BeginInvoke(uiUpdaterMsBuild, DispatcherPriority.Normal, messageArgs.LogMessage); break; case MessageSource.EnqueueLogger: case MessageSource.DenqueueLogger: case MessageSource.ExecutionLogger: rtbExecution.Dispatcher.BeginInvoke(uiUpdaterExecution, DispatcherPriority.Normal, messageArgs.LogMessage); break; case MessageSource.ResultsParser: NavigateToNextPage ng = new NavigateToNextPage(Navigate); mainGrid.Dispatcher.BeginInvoke(ng, DispatcherPriority.Send, messageArgs.LogMessage); break; } } } } }
public static void InitTimer(UpdateProgress progressP) { progress = progressP; }
public MainForm() { InitializeComponent(); my_delegate = new UpdateProgress(UpdateProgressMethod); max_delegate = new UpdateMax(UpdateMaxMethod); }
public static void ReadRemoteMediaFileHttpWithProgress(string filepath, string url, UpdateProgress progress, Complete complete) { using (WebClient webClient = new WebClient()) { webClient.DownloadFileCompleted += (sender, e) => { complete(!e.Cancelled); }; webClient.DownloadProgressChanged += (sender, e) => { progress(e.BytesReceived, e.TotalBytesToReceive); }; Uri uri = new Uri(url); try { webClient.DownloadFileAsync(uri, filepath); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } }
private void backgroundWorker1_DoWork() { while (isConnected) { NetworkStream serverStream = clientTcpListner.GetStream(); byte[] inStream = new byte[10025]; serverStream.Read(inStream, 0, (int)clientTcpListner.ReceiveBufferSize); string returndata = System.Text.Encoding.ASCII.GetString(inStream); UpdateProgress uiUpdater = new UpdateProgress(DisplayClientMessage); if (returndata != String.Empty) { this.Dispatcher.BeginInvoke(uiUpdater, returndata); } Thread.Sleep(1000); } }