Ejemplo n.º 1
0
        Control StartStopButton(ProgressBar bar)
        {
            var control = new Button {
                Text = "Start Timer"
            };

            control.Click += delegate {
                if (timer == null)
                {
                    timer = new UITimer {
                        Interval = 0.5
                    };
                    timer.Elapsed += delegate {
                        if (bar.Value < bar.MaxValue)
                        {
                            bar.Value += 50;
                        }
                        else
                        {
                            bar.Value = bar.MinValue;
                        }
                    };
                    timer.Start();
                    control.Text = "Stop Timer";
                }
                else
                {
                    timer.Stop();
                    timer.Dispose();
                    timer        = null;
                    control.Text = "Start Timer";
                }
            };
            return(control);
        }
Ejemplo n.º 2
0
        private void GvSelectionChanged(object sender, EventArgs e)
        {
            var id = GetSlectedWorkflowId();
            var wf = GetWorkflow(id);

            if (_timer != null && _timer.Started)
            {
                _timer.Stop();
                _timer.Dispose();
            }

            if (wf != null && wf.IsEnabled)
            {
                _timer = new UITimer {
                    Interval = 0.5
                };
                _timer.Elapsed += (s, ea) => UpdateButtons(id, false);
                _timer.Start();

                UpdateButtons(id, true);
            }
            else
            {
                UpdateButtons(id, true);
            }
        }
Ejemplo n.º 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         fInnerTimer.Dispose();
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 4
0
 protected override void StopTimer()
 {
     if (fTimer != null)
     {
         fTimer.Stop();
         fTimer.Dispose();
         fTimer = null;
     }
 }
Ejemplo n.º 5
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            _disposed = true;

            if (disposing)
            {
                _timer.Dispose();
            }
        }
Ejemplo n.º 6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (blinkTimer != null)
                {
                    blinkTimer.Stop();
                    blinkTimer.Dispose();
                    blinkTimer = null;
                }
            }

            var doc = CharacterDocument;

            doc.Info.DosAspectChanged  -= Info_DosAspectChanged;
            doc.Info.iCEColoursChanged -= Info_iCEColoursChanged;

            doc.ICEColoursChanged -= Info_iCEColoursChanged;
            doc.SizeChanged       -= document_SizeChanged;

            base.Dispose(disposing);
        }
Ejemplo n.º 7
0
            protected override void OnUnLoad(EventArgs e)
            {
                base.OnUnLoad(e);

                if (_objectsSubscription != null)
                {
                    _objectsSubscription.Dispose();
                    _objectsSubscription = null;
                }

                if (_searchTimer != null)
                {
                    _searchTimer.Dispose();
                    _searchTimer = null;
                }
            }
Ejemplo n.º 8
0
        protected override void OnUnLoad(EventArgs e)
        {
            base.OnUnLoad(e);

            if (this._devicesSubscription != null)
            {
                this._devicesSubscription.Dispose();
                this._devicesSubscription = null;
            }

            if (_refreshTimer != null)
            {
                _refreshTimer.Dispose();
                _refreshTimer = null;
            }

            this._devices = null;
            this.Content  = null;
        }
Ejemplo n.º 9
0
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    if (timer != null)
                    {
                        timer.Stop();
                        timer.Dispose();
                        timer = null;
                    }

                    RegisterIndependentView(false);

                    if (editorControl != null)
                    {
                        editorControl.Dispose();
                        editorControl = null;
                    }

                    if (host != null)
                    {
                        host.Dispose();
                        host = null;
                    }
                    var builderDispose = builder as IDisposable;
                    if (builderDispose != null)
                    {
                        builderDispose.Dispose();
                    }

                    GC.SuppressFinalize(this);
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
Ejemplo n.º 10
0
        protected override void Dispose(bool disposing)
        {
            if (scrollTimer != null)
            {
                scrollTimer.Dispose();
                scrollTimer = null;
            }

#if MOBILE
            if (this.ViewHandler != null)
            {
                Console.WriteLine("Disposing viewer pane");
                if (this.ViewHandler.Document != null)
                {
                    this.ViewHandler.Document.Dispose();
                }
                this.ViewHandler.Dispose();
                //this.ViewHandler = null;
            }
#endif

            base.Dispose(disposing);
        }
Ejemplo n.º 11
0
        public MainForm()
        {
            Title = "EtoPaint";

            BlankBuffer = File.ReadAllBytes("Blank.bmp");

            // menu
            Menu = new MenuBar
            {
                Items =
                {
                    // menu/file
                    new ButtonMenuItem
                    {
                        Text  = "&File",
                        Items =
                        {
                            // menu/file/new
                            new Command((s,        e) =>{
                                Buffer = (byte[])BlankBuffer.Clone();
                                Repaint();
                            })
                            {
                                MenuText = "New",  Shortcut = Keys.F2
                            },

                            // menu/file/about
                            new ButtonMenuItem((s, e) =>
                                               new Dialog()
                            {
                                Content = new Label
                                {
                                    Text = "This is just a test app to see the posibilities and performance of Eto.Forms.",
                                },
                                ClientSize = new Size(250,                     100),
                                Padding    = new Padding(15)
                            }.ShowModal(this)
                                               )
                            {
                                Text = "&About..."
                            },

                            // menu/file/quit
                            new Command((s,        e) => Application.Instance.Quit())
                            {
                                MenuText = "&Quit",
                                Shortcut = Application.Instance.CommonModifier | Keys.Q
                            }
                        }
                    },

                    new ButtonMenuItem((s, e) =>
                    {
                        var d = new ColorDialog{
                            Color = PaintColor, AllowAlpha = false
                        };
                        d.ShowDialog(this);
                        PaintColor = d.Color;
                    })
                    {
                        Text = "Change color"
                    },

                    new ButtonMenuItem((s, e) => Timer.Start())
                    {
                        Text = "Start"
                    },
                    new ButtonMenuItem((s, e) => Timer.Stop())
                    {
                        Text = "Stop"
                    }
                }
            };

            Buffer  = (byte[])BlankBuffer.Clone();
            Bmp     = new Bitmap(Buffer);
            Content = Img = new ImageView {
                Image = Bmp, Size = new Size(256, 240)
            };

            Timer = new UITimer((s, e) => DrawRandom())
            {
                Interval = 0.016667
            };

            //due to a bug, this won't work on linux (Eto issues #1730 on github)
            Img.MouseMove += (s, e) =>
            {
                int x = (int)e.Location.X;
                int y = 239 - (int)e.Location.Y;

                if (e.Buttons.HasFlag(MouseButtons.Primary) && x >= 0 && x <= 255 && y >= 0 && y <= 239)
                {
                    DrawPixel(x, y);
                }
            };

            Closing += (s, e) =>
            {
                Bmp.Dispose();
                Timer.Dispose();
            };
        }