-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andy Bradford
committed
Feb 12, 2021
1 parent
136c7fa
commit 803e3c5
Showing
14 changed files
with
137 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 7 additions & 21 deletions
28
src/electronApp/angularApp/components/print/print.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
<ng-container | ||
*ngIf="SendInProgress; then sending; else ready"> | ||
</ng-container> | ||
|
||
<ng-template #ready> | ||
<div #ready class="uploadFileContainer" (click)="fileInput.click()" appDragDrop (FileDropped)="uploadFile($event)"> | ||
<span *ngIf="ErrorMessage" class="error warningColor">{{ErrorMessage}}</span> | ||
<span *ngIf="Success" class="success">File transferred successfully 🙂</span> | ||
<span class="instructions drag">To print a .gx .gcode or .g file, drag it here or click to pick.</span> | ||
<span class="instructions drop">Drop file here to print it.</span> | ||
<input hidden type="file" #fileInput (change)="uploadFile($event.target.files)"> | ||
</div> | ||
</ng-template> | ||
|
||
<ng-template #sending> | ||
<div #sending class="sendInProgress"> | ||
<mat-spinner diameter="50"></mat-spinner> | ||
<br> | ||
<span>Transferring file to printer</span> | ||
</div> | ||
</ng-template> | ||
<div class="uploadFileContainer" (click)="fileInput.click()" appDragDrop (FileDropped)="uploadFile($event)"> | ||
<span *ngIf="ErrorMessage" class="error warningColor">{{ErrorMessage}}</span> | ||
<span *ngIf="Success" class="success">File transferred successfully 🙂</span> | ||
<span class="instructions drag">To print a .gx .gcode or .g file, drag it here or click to pick.</span> | ||
<span class="instructions drop">Drop file here to print it.</span> | ||
<input hidden type="file" #fileInput (change)="uploadFile($event.target.files)"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/electronApp/angularApp/components/transferring-dialog/transferring-dialog.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.sendInProgress { | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/electronApp/angularApp/components/transferring-dialog/transferring-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div #sending class="sendInProgress"> | ||
<mat-spinner diameter="50"></mat-spinner> | ||
<br> | ||
<span>Please wait. Transferring file to printer.</span> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
src/electronApp/angularApp/components/transferring-dialog/transferring-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component, OnInit, Inject, ChangeDetectorRef, ApplicationRef, ViewChild, ElementRef } from '@angular/core'; | ||
import { PromiseWithProgress } from '../../../core' | ||
import {MAT_DIALOG_DATA} from '@angular/material/dialog'; | ||
|
||
@Component({ | ||
selector: 'app-transferring-dialog', | ||
templateUrl: './transferring-dialog.component.html', | ||
styleUrls: ['./transferring-dialog.component.css'] | ||
}) | ||
export class TransferringDialogComponent implements OnInit { | ||
|
||
constructor(applicationRef: ApplicationRef, private cdr: ChangeDetectorRef, @Inject(MAT_DIALOG_DATA) public data: {promiseWithProgress: PromiseWithProgress<void>}) { | ||
|
||
} | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { EventDispatcher } from './eventDispatcher'; | ||
|
||
export class PromiseWithProgress<T> { | ||
public readonly Promise: Promise<T>; | ||
|
||
public readonly Progress = new EventDispatcher<number>(); | ||
|
||
constructor (func: (updateProgress: (value: number) => void) => Promise<T>){ | ||
this.Promise = func((value: number) => this.UpdateProgress(value)); | ||
} | ||
|
||
private UpdateProgress(value: number): void{ | ||
if (value < 0 || value > 1){ | ||
throw new Error("Value is out of range"); | ||
} | ||
|
||
this.Progress.Invoke(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './errorLogger'; | ||
export * from './eventDispatcher'; | ||
export * from './PromiseWithProgress'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters