Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2010-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
13 using System.Windows.Forms;
15 namespace OpenHardwareMonitor.GUI {
16 public abstract class Gadget : IDisposable {
18 private GadgetWindow window;
21 this.window = new GadgetWindow();
22 this.window.Paint += delegate(object sender, PaintEventArgs e) {
27 public virtual void Dispose() {
31 public Point Location {
33 return window.Location;
36 window.Location = value;
40 public event EventHandler LocationChanged {
42 window.LocationChanged += value;
45 window.LocationChanged -= value;
49 public virtual Size Size {
54 this.window.Size = value;
58 public event EventHandler SizeChanged {
60 window.SizeChanged += value;
63 window.SizeChanged -= value;
69 return window.Opacity;
72 window.Opacity = value;
76 public bool LockPositionAndSize {
78 return window.LockPositionAndSize;
81 window.LockPositionAndSize = value;
85 public bool AlwaysOnTop {
87 return window.AlwaysOnTop;
90 window.AlwaysOnTop = value;
94 public ContextMenu ContextMenu {
96 return window.ContextMenu;
99 window.ContextMenu = value;
103 public event HitTestEventHandler HitTest {
105 window.HitTest += value;
108 window.HitTest -= value;
112 public event MouseEventHandler MouseDoubleClick {
114 window.MouseDoubleClick += value;
117 window.MouseDoubleClick -= value;
121 public bool Visible {
123 return window.Visible;
126 if (value != window.Visible) {
127 window.Visible = value;
128 if (VisibleChanged != null)
129 VisibleChanged(this, EventArgs.Empty);
136 public event EventHandler VisibleChanged;
138 public void Redraw() {
142 protected abstract void OnPaint(PaintEventArgs e);