/// <summary> /// Konstruktor. /// </summary> /// <param name="statusChangedHandler">Handler für Statusmeldungen. Kann auch null sein.</param> public ErzeugeAlleExcelDateien(StatusChanged statusChangedHandler) { KursTableAdapter ta = new KursTableAdapter(); var kurse = ta.GetData(); int count = 0; foreach (var kurs in kurse) { //if (kurs.Id > 824 && kurs.Id < 840) //if (kurs.Id==851) { if (statusChangedHandler != null) { statusChangedHandler(this, new StatusChangedEventArgs() { Meldung = "Erzeuge Datei" + count + " von " + kurse.Count }); } new ErzeugeExcelDatei(kurs); count++; } } if (statusChangedHandler != null) { statusChangedHandler(this, new StatusChangedEventArgs() { Meldung = count + " Dateien erfolgreich erzeugt" }); } }
public frmKRTD() { InitializeComponent(); m_StatusChanged = new StatusChanged(this.applyStatusChanged); m_menu = new ContextMenu(); m_menu.MenuItems.Add(0, new MenuItem("Show", new System.EventHandler(Show_Click))); m_menu.MenuItems.Add(1, new MenuItem("Hide", new System.EventHandler(Hide_Click))); m_menu.MenuItems.Add(2, new MenuItem("ReSubscribe", new System.EventHandler(Resub_Click))); m_menu.MenuItems.Add(3, new MenuItem("ReStart", new System.EventHandler(ReStart_Click))); m_menu.MenuItems.Add(2, new MenuItem("Start", new System.EventHandler(Start_Click))); m_menu.MenuItems.Add(2, new MenuItem("Stop", new System.EventHandler(Stop_Click))); notifyIcon1.ContextMenu = m_menu; m_StatusValues = new List<string>(); txtWrkDir.Text = Directory.GetCurrentDirectory(); txtMachine.Text = System.Environment.MachineName; }
public LeseNotenAusExcel(string afileName, StatusChanged StatusChangedMethod) { fileName = afileName; this.StatusChanged = StatusChangedMethod; Status("Öffne Datei " + afileName); xls = new OpenNotendatei(fileName); // Liste der gespeicherten Sids bereitstellen (alte Sids sollen nicht aus Excel gelöscht werden) for (int i = CellConstant.zeileSIdErsterSchueler; i < CellConstant.zeileSIdErsterSchueler + OpenNotendatei.MaxAnzahlSchueler; i++) { int sid = Convert.ToInt32(xls.ReadValue(xls.sid, CellConstant.SId + i)); if (sid == int.MaxValue) { continue; // Schüler wurde gelöscht } else { if (sid == 0) break; sidList.Add(sid); } } kurs = new Kurs(Convert.ToInt32(xls.ReadValue(xls.sid, CellConstant.KursId))); Status("Synchronisiere Datei " + afileName); Synchronize(); Status("Übertrage Noten aus Datei " + afileName); DeleteAlteNoten(); UebertrageNoten(); success = true; // TODO: Gefährlich, private Variablen zu disposen? xls.Dispose(); xls = null; Status("fertig mit Datei " + afileName); }
/// <summary> /// Raises <see cref="StatusChanged"/> event. /// </summary> protected void OnStatusChanged() { StatusChanged?.Invoke(this); OnWorkerResourcesChanged(WorkerResource.Status, increased: Status == WorkerNodeStatus.Running); }
public void CallStatusUpdate(Object sender, StatusChanged e) { StatusUpdate(sender, e); }
public override void Stop() { CheckNifudaThread?.Abort(); StatusChanged?.Invoke(this, false); }
/// <summary> /// Raises the StatusChanged event /// </summary> protected virtual void OnStatusChanged() { StatusChanged?.Invoke(this, EventArgs.Empty); }
private void StatusChange(DownloadStatus status, string message = null) { Status = status; StatusChanged?.Invoke(this, new DownloadStatusChangeArgs(status, message)); }
void SetStatus(ListenerStatus status) { Status = status; StatusChanged?.Invoke(this, EventArgs.Empty); }
void OnStatusChanged(SchedulerStatusEventArgs e) { StatusChanged?.Invoke(this, e); }
private void OnStatusChanged(bool isRunning) { StatusChanged?.Invoke(this, new SchedulerStatusEventArgs(isRunning)); }
private void OnStatusChanged(bool isStepperReady) { var e = new StepperStatusChangedEventHandlerArgs(isStepperReady); StatusChanged?.Invoke(this, e); }
void IXSpi.ProcessConnectionStatus(ConnectionStatus status, RspUserLoginField login) { StatusChanged?.Invoke(this, status, login); }
private void Connection_Ready(object sender, EventArgs e) { StatusChanged?.Invoke(this, ConnectionStatus.Connected); }
private void rtc_OnPresenceChanged(object sender, AVIMEventArgs e) { string[] array = new string[2] { "on", "off" }; StatusChanged[] statusChangedArray = new StatusChanged[2] { new StatusChanged(this.OnPeerOnline), new StatusChanged(this.OnPeerOffline) }; int index = Array.IndexOf<string>(array, e.Presence.Status); if (index <= -1) return; statusChangedArray[index](this, e.Presence.SessionPeerIds); }
/// <summary> /// The logging scenario. Log messages in a loop until 3 log files are created. /// </summary> /// <returns>The task.</returns> public async Task DoScenarioAsync() { CheckDisposed(); IsBusy = true; try { await Task.Run(async() => { const int NUMBER_OF_LOG_FILES_TO_GENERATE = 3; int messageIndex = 0; int lastDelay = 0; int lastAppError = 0; int startFileCount = LogFileGeneratedCount; // // Log large messages until the current log file hits the maximum size. // When the current log file reaches its maximum size, LogFileGeneratedHandler // will be called. // while (LogFileGeneratedCount - startFileCount < NUMBER_OF_LOG_FILES_TO_GENERATE) { try { // Since the channel is added to the session at level Warning, // the following is logged because it is logged at level LoggingLevel.Critical. channel.LogMessage( string.Format("Message={0}: Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ligula nisi, vehicula nec eleifend vel, rutrum non dolor. Vestibulum ante ipsum " + "primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur elementum scelerisque accumsan. In hac habitasse platea dictumst.", ++messageIndex), LoggingLevel.Critical); // Since the channel is added to the session at level Warning, // the following is *not* logged because it is logged at LoggingLevel.Information. channel.LogMessage( string.Format("Message={0}: Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ligula nisi, vehicula nec eleifend vel, rutrum non dolor. Vestibulum ante ipsum " + "primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur elementum scelerisque accumsan. In hac habitasse platea dictumst.", ++messageIndex), LoggingLevel.Information); int value = 1000000; // one million, 7 digits, 4-bytes as an int, 14 bytes as a wide character string. channel.LogMessage("Value #" + (++messageIndex).ToString() + " " + value.ToString(), LoggingLevel.Critical); // value is logged as 14 byte wide character string. channel.LogValuePair("Value #" + (++messageIndex).ToString(), value, LoggingLevel.Critical); // value is logged as a 4-byte integer. // // Pause every once in a while to simulate application // activity outside of logging. // if (messageIndex - lastDelay > 100) { lastDelay = messageIndex; await Task.Delay(10); } // // Every once in a while, simulate an application error // which causes the app to save the current snapshot // of logging events in memory to a disk ETL file. // if (messageIndex - lastAppError >= 25000) { lastAppError = messageIndex; // Before simulating an application error, demonstrate LoggingActivity. // A LoggingActivity outputs a pair of begin and end messages to the channel. using (new LoggingActivity("Add two numbers.", channel, LoggingLevel.Critical)) { int oneNumber = 100; int anotherNumber = 200; int total = oneNumber + anotherNumber; channel.LogMessage(string.Format("Message={0}: The result of adding two numbers: {1}", ++messageIndex, total), LoggingLevel.Critical); } // The LoggingActivity instance will log the second message at this scope exit. // Simulate an application error. throw new AppException("Some bad app error occurred."); } } catch (AppException e) { // Log the exception string. channel.LogMessage("Exception occurrred: " + e.ToString(), LoggingLevel.Error); // Save the memory log buffer to file. Task <string> op = SaveLogInMemoryToFileAsync(); op.Wait(); if (op.IsFaulted) { throw new Exception("After an app error occurred, there was a failure to save the log file.", op.Exception); } LogFileGeneratedCount++; // For the sample, update the UI to show a log file has been generated. if (StatusChanged != null) { StatusChanged.Invoke(this, new LoggingScenarioEventArgs(LoggingScenarioEventType.LogFileGenerated, op.Result)); } } } }); } finally { IsBusy = false; } }
public void UploadFileAsync(string filePath, byte[] fileByteArray, StatusChanged downloadCompleted) { if (CurrentSecret == null) return; string destinationPath = String.Format ( "/api/{0}/{1}", CurrentSecret, UrlHelper.GetFileName (filePath) ); WebClient client = new WebClient (); client.Headers ["content-type"] = "application/octet-stream"; client.Encoding = Encoding.UTF8; client.UploadDataCompleted += (sender, e) => { downloadCompleted (); if (e.Cancelled) { Console.Out.WriteLine ("Upload file cancelled."); return; } if (e.Error != null) { Console.Out.WriteLine ( "Error uploading file: {0}", e.Error.Message ); return; } string response = System.Text.Encoding.UTF8.GetString (e.Result); if (!String.IsNullOrEmpty (response)) { } }; Send (destinationPath); Uri fileUri = new Uri (SERVER + destinationPath); client.UploadDataAsync (fileUri, "POST", fileByteArray); }
protected void InvokeStatusChanged() { StatusChanged?.Invoke(this, new EventArgs()); }
public static void Break() { Closed = false; StatusChanged?.Invoke(null, EventArgs.Empty); }
public void Status(string status) { StatusChanged.Raise(this, new StatusChangedEventArgs(status)); }
/// <summary> /// Вызвать событие StatusChanged /// </summary> private void OnStatusChanged() { StatusChanged?.Invoke(this, EventArgs.Empty); }
public static void Reset() { Closed = true; StatusChanged?.Invoke(null, EventArgs.Empty); }
protected virtual void OnStatusChanged() { StatusChanged?.Invoke(this, null); }
private void OnStatusChanged(CcjRoundStatus status) => StatusChanged?.Invoke(this, status);
protected virtual void OnStatusChanged(StatusChangedEventArgs args) { StatusChanged?.Invoke(this, args); }
//public void Connect(EventHandler<TestEventArgs> handler) //{ // StatusChanged += handler; //} //public void Disconnect(EventHandler<TestEventArgs> handler) //{ // StatusChanged -= handler; //} private void OnStatusChange() { StatusChanged?.Invoke(this, new TestEventArgs("Az osztály állapota megváltozott: " + this.data)); }
private void OnStatusChanged(bool started) { StatusChanged?.Invoke(this, started); }
private void RaiseStatusChanged(ValidationStatus status, IReadOnlyCollection <string> messages) { _StatusChanged?.Invoke(new ValidationsStatusChangedEventArgs(status, messages)); InvokeAsync(() => StatusChanged.InvokeAsync(new ValidationsStatusChangedEventArgs(status, messages))); }
public override OperationResult Perform() { var result = OperationResult.Success; if (Context.Next.Settings.SessionMode == SessionMode.Server) { logger.Info("Initializing server..."); StatusChanged?.Invoke(TextKey.OperationStatus_InitializeServer); server.Initialize(Context.Next.Settings.Server); var(abort, fallback, success) = TryPerformWithFallback(() => server.Connect()); if (success) { (abort, fallback, success) = TryPerformWithFallback(() => server.GetAvailableExams(Context.Next.Settings.Server.ExamId), out var exams); if (success) { var exam = default(Exam); if (!string.IsNullOrWhiteSpace(Context.Next.Settings.Server.ExamId)) { exam = exams.First(); logger.Info("Automatically selected exam as defined in configuration."); } else { success = TrySelectExam(exams, out exam); } if (success) { (abort, fallback, success) = TryPerformWithFallback(() => server.GetConfigurationFor(exam), out var uri); if (success) { var info = server.GetConnectionInfo(); var status = TryLoadSettings(uri, UriSource.Server, out _, out var settings); fileSystem.Delete(uri.LocalPath); if (status == LoadStatus.Success) { var serverSettings = Context.Next.Settings.Server; Context.Next.AppConfig.ServerApi = info.Api; Context.Next.AppConfig.ServerConnectionToken = info.ConnectionToken; Context.Next.AppConfig.ServerExamId = exam.Id; Context.Next.AppConfig.ServerOauth2Token = info.Oauth2Token; Context.Next.Settings = settings; Context.Next.Settings.Browser.StartUrl = exam.Url; Context.Next.Settings.Server = serverSettings; Context.Next.Settings.SessionMode = SessionMode.Server; result = OperationResult.Success; } else { result = OperationResult.Failed; } } } else { logger.Info("The user aborted the exam selection."); result = OperationResult.Aborted; } } } if (abort) { result = OperationResult.Aborted; } if (fallback) { Context.Next.Settings.SessionMode = SessionMode.Normal; result = OperationResult.Success; } } return(result); }
public void Start() { StatusChanged?.Invoke(Status.Started); }
public void Stop() { Status = ListenerStatus.NotListening; StatusChanged?.Invoke(this, EventArgs.Empty); }
public void Stop() { StatusChanged?.Invoke(Status.Stopped); }
private void OnStatusChanged(StatusChangedEventArgs args) { StatusChanged?.Invoke(this, args); }
private void OnStatusValueChaned(ProgressReport value) { StatusChanged?.Invoke(this, new ValueEventArgs(value)); }
/// <summary> /// Konstruktor. /// </summary> /// <param name="statusChangedHandler">Handler für Statusmeldungen. Kann auch null sein.</param> public SendExcelMails(StatusChanged statusChangedHandler) { LehrerTableAdapter ada = new LehrerTableAdapter(); var rows = ada.GetData(); int count = 0; foreach (diNoDataSet.LehrerRow row in rows) { string directoryName = Konstanten.ExcelPfad + row.Kuerzel; if (!Directory.Exists(directoryName) || Directory.GetFiles(directoryName).Count() == 0) { log.Warn("Unterrichtet der Lehrer " + row.Name + " nix ?"); continue; } string dienstlicheMailAdresse = row.EMail; if (statusChangedHandler != null) { statusChangedHandler(this, new StatusChangedEventArgs() { Meldung = count + " von " + rows.Count + " gesendet" }); } //SendMail("*****@*****.**", dienstlicheMailAdresse, Directory.GetFiles(directoryName)); SendMail("*****@*****.**", dienstlicheMailAdresse, Directory.GetFiles(directoryName)); count++; } }
protected virtual void RaiseStatusChanged() => StatusChanged?.Invoke(this, new EventArgs());
public void UploadFileAsync(string filePath, StatusProgressChanged uploadProgressChanged, StatusChanged uploadCompleted) { if (CurrentSecret == null) return; var destinationPath = String.Format ("/api/{0}/{1}", CurrentSecret, UrlHelper.GetFileName (filePath)); var client = new ProgressBugfixedWebClient ((new FileInfo(filePath)).Length); client.Headers ["content-type"] = "application/octet-stream"; client.Encoding = Encoding.UTF8; client.UploadProgressChanged += (sender, e) => { uploadProgressChanged (e); }; client.UploadFileCompleted += (sender, e) => { uploadCompleted (); if (e.Cancelled) { Console.Out.WriteLine ("Upload file cancelled."); return; } if (e.Error != null) { Console.Out.WriteLine ("Error uploading file: {0}", e.Error.Message); return; } var response = System.Text.Encoding.UTF8.GetString (e.Result); if (!String.IsNullOrEmpty (response)) { } }; Send (destinationPath); client.computeContentLength(filePath); client.UploadFileAsync (new Uri (SERVER + destinationPath), "POST", filePath); }
private void ReportStatus(string status = null, string description = null) { StatusChanged?.Invoke(this, new StatusChangedEventArgs(status, description)); }