Exemple #1
0
 private void Printer_PrintFinished(object sender, PrintFinishedEventArgs e)
 {
     if (isPrinting)
     {
         PrintFinished?.Invoke(this, e);
         isPrinting = false;
         isHomed    = false;
     }
     if (isFilamentChanging && filamentChangeBegin)
     {
         FilamentChangeBegin?.Invoke(this, e);
         filamentChangeBegin = false;
         videoIsPlaying      = true;
         isHomed             = false;
     }
     if (isFilamentChanging && filamentChangeEnd)
     {
         FilamentChangeEnd?.Invoke(this, e);
         filamentChangeEnd = false;
         isHomed           = false;
     }
     if (isMovedManually)
     {
         isMovedManually = false;
         MoveCompleted?.Invoke(this, null);
     }
 }
Exemple #2
0
        public MainModel()
        {
            updateWorker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                var bulkFile = $@"data\default-temp.json";
                var bulkInfo = e.Argument as Bulk;
                cardLoader.DownloadFile(bulkInfo.PermalinkUri, bulkFile);

                var cards = JsonConvert.DeserializeObject <ScryCard[]>(File.ReadAllText(bulkFile));

                ConvertToLocal(bulkInfo.UpdatedAt, cards);

                localData.Version = LOCALDATA_VERSION;

                SaveLocalData();
                File.Delete(bulkFile);
            };
            updateWorker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args)
            {
                LocalDataUpdated?.Invoke(this, args);
            };

            printWorker.DoWork             += DoPrintWork;
            printWorker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args)
            {
                PrintFinished?.Invoke(this, args);
            };

            artWorker.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                var pair = (KeyValuePair <string, string>)e.Argument;
                artLoader.DownloadFile(pair.Key, pair.Value);
            };
            artWorker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args)
            {
                ArtDownloaded?.Invoke(this, args);
            };
        }
Exemple #3
0
 protected virtual void OnPrintFinished(EventArgs e)
 {
     PrintFinished?.Invoke(this, EventArgs.Empty);
 }
 /// <summary>
 /// Prints something on the stream.
 /// </summary>
 /// <param name="stream">Certain stream.</param>
 public virtual void Print(Stream stream)
 {
     PrintStarted?.Invoke(this, new PrintStartedEventArgs("Print started."));
     Printing(stream);
     PrintFinished?.Invoke(this, new PrintFinishedEventArgs("Print finished"));
 }
 private void OnPrintFinished()
 {
     Thread.Sleep(1000);
     PrintFinished?.Invoke(this, EventArgs.Empty);
 }
 internal void OnPrintFinished(float time)
 {
     PrintFinished?.Invoke(this, new PrintFinishedEventArgs(time));
 }