BioGTK  6.5.0
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
Loading...
Searching...
No Matches
Progress.cs
1using AForge;
2using Gdk;
3using Gtk;
4using sun.tools.tree;
5using System;
6using System.Collections.Generic;
7using System.IO;
8using System.Linq;
9using System.Text;
10using System.Threading.Tasks;
11
12namespace BioGTK
13{
14
15 public class Progress : Gtk.Dialog
16 {
17 #region Properties
18 private Builder _builder;
19
20 /* A property that is used to update the progress bar. */
21 public double ProgressValue
22 {
23 get
24 {
25 return progressBar.Fraction;
26 }
27 set
28 {
29 // update progress bar on main UI thread
30 Application.Invoke(delegate
31 {
32 if(value <= 1)
33 progressBar.Fraction = value;
34 else
35 progressBar.Fraction = value / 100;
36 });
37 }
38 }
39 /* A property that is used to update the progress bar. */
40 public string Text
41 {
42 get { return progLabel.Text; }
43 set
44 {
45 // update progress bar on main UI thread
46 Application.Invoke(delegate
47 {
48 progLabel.Text = value;
49 });
50 }
51 }
52 /* A property that is used to update the progress bar. */
53 public string Status
54 {
55 get { return statusLabel.Text; }
56 set
57 {
58 // update progress bar on main UI thread
59 Application.Invoke(delegate
60 {
61 statusLabel.Text = value;
62 });
63 }
64 }
65#pragma warning disable 649
66
67 [Builder.Object]
68 private ProgressBar progressBar;
69 [Builder.Object]
70 private Label progLabel;
71 [Builder.Object]
72 private Label statusLabel;
73#pragma warning restore 649
74
75 #endregion
76
77 #region Constructors / Destructors
78
79
80 public static Progress Create(string title, string status, string state)
81 {
82 Builder builder = new Builder(new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/" + "Glade/Progress.glade", FileMode.Open));
83 return new Progress(builder, builder.GetObject("progress").Handle, title, status, state);
84 }
85
86
87 /* The constructor for the class. */
88 protected Progress(Builder builder, IntPtr handle, string title, string status, string state) : base(handle)
89 {
90 _builder = builder;
91 builder.Autoconnect(this);
92 this.Title = title;
93 this.statusLabel.Text = status;
94 this.progLabel.Text = state;
95 App.ApplyStyles(this);
96 }
97
98 #endregion
99
100 }
101}
Definition ML.cs:17