コード例 #1
0
        protected override void RunProxyImpl(CommandSettings settings)
        {
            // prepare Windows system event handlers
            SessionEndingEventHandler onSessionEnding = (o, e) => {
                AwakeControllerThread(ControllerThreadSynchronizer.EventKind.SystemSessionEnding);
            };
            PowerModeChangedEventHandler onPowerModeChanged = (o, e) => {
                switch (e.Mode)
                {
                case PowerModes.Suspend:
                    AwakeControllerThread(ControllerThreadSynchronizer.EventKind.Suspend);
                    break;

                case PowerModes.Resume:
                    AwakeControllerThread(ControllerThreadSynchronizer.EventKind.Resume);
                    break;
                }
            };

            // run the proxy
            SystemEvents.SessionEnding    += onSessionEnding;
            SystemEvents.PowerModeChanged += onPowerModeChanged;
            try {
                base.RunProxyImpl(settings);
            } finally {
                SystemEvents.PowerModeChanged -= onPowerModeChanged;
                SystemEvents.SessionEnding    -= onSessionEnding;
            }

            return;
        }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// sessionendingeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this SessionEndingEventHandler sessionendingeventhandler, Object sender, SessionEndingEventArgs e, AsyncCallback callback)
        {
            if (sessionendingeventhandler == null)
            {
                throw new ArgumentNullException("sessionendingeventhandler");
            }

            return(sessionendingeventhandler.BeginInvoke(sender, e, callback, null));
        }
コード例 #3
0
        public WebDAVServerForm(string[] arg)
        {
            InitializeComponent();

            /* append version number */
            Text += " v" + WebDAVServer.Version;

            /* register stuff for minimizing etc */
            Resize += new EventHandler(WebDAVServer_Resize);

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                notifyIcon.MouseClick      += new MouseEventHandler(notifyIcon_MouseClick);
                notifyIcon.ContextMenuStrip = contextMenuToolbar;
                this.notifyIcon.Visible     = true;
            }


            UpdateTimer          = new System.Windows.Forms.Timer();
            UpdateTimer.Interval = 100;
            UpdateTimer.Tick    += new EventHandler(UpdateTimer_Tick);
            UpdateTimer.Start();

            UpdateButtons();

            SessionEnding += new SessionEndingEventHandler(WebDAVServerForm_SessionEnding);

            Server             = new WebDAVServer(arg);
            Server.LogUpdated += new EventHandler(Server_LogUpdated);
            Server.Start(false);


            txtPath.Text         = Server.Settings.Path;
            txtPort.Text         = Server.Settings.Port.ToString();
            txtAuth.Text         = Server.Settings.AuthTokens;
            txtCacheTime.Text    = Server.Settings.CacheTime.ToString();
            txtPrefetch.Text     = Server.Settings.PrefetchCount.ToString();
            chkShowInfos.Checked = Server.Settings.ShowInfos;
            chkShowJpeg.Checked  = Server.Settings.ShowJpeg;
            chkShowFits.Checked  = Server.Settings.ShowFits;
            chkShowDng.Checked   = Server.Settings.ShowDng;
            chkShowWav.Checked   = Server.Settings.ShowWav;

            UpdateDriveLetters();
        }
コード例 #4
0
        public WebDAVServerForm(string[] arg)
        {
            InitializeComponent();

            /* append version number */
            Text += " v" + WebDAVServer.Version;

            /* register stuff for minimizing etc */
            Resize += new EventHandler(WebDAVServer_Resize);

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                notifyIcon.MouseClick += new MouseEventHandler(notifyIcon_MouseClick);
                notifyIcon.ContextMenuStrip = contextMenuToolbar;
                this.notifyIcon.Visible = true;
            }

            UpdateTimer = new System.Windows.Forms.Timer();
            UpdateTimer.Interval = 100;
            UpdateTimer.Tick += new EventHandler(UpdateTimer_Tick);
            UpdateTimer.Start();

            UpdateButtons();

            SessionEnding += new SessionEndingEventHandler(WebDAVServerForm_SessionEnding);

            Server = new WebDAVServer(arg);
            Server.LogUpdated += new EventHandler(Server_LogUpdated);
            Server.Start(false);

            txtPath.Text = Server.Settings.Path;
            txtPort.Text = Server.Settings.Port.ToString();
            txtAuth.Text = Server.Settings.AuthTokens;
            txtCacheTime.Text = Server.Settings.CacheTime.ToString();
            txtPrefetch.Text = Server.Settings.PrefetchCount.ToString();
            chkShowInfos.Checked = Server.Settings.ShowInfos;
            chkShowJpeg.Checked = Server.Settings.ShowJpeg;
            chkShowFits.Checked = Server.Settings.ShowFits;
            chkShowDng.Checked = Server.Settings.ShowDng;
            chkShowWav.Checked = Server.Settings.ShowWav;

            UpdateDriveLetters();
        }
コード例 #5
0
        public void CancelSessionEnding()
        {
            bool shouldCancel = false;
            SessionEndingEventHandler endingHandler = (o, e) =>
            {
                e.Cancel = shouldCancel;
            };

            SystemEvents.SessionEnding += endingHandler;
            try
            {
                Assert.Equal((IntPtr)1, SendMessage(0));
                shouldCancel = true;
                Assert.Equal((IntPtr)0, SendMessage(0));
            }
            finally
            {
                SystemEvents.SessionEnding -= endingHandler;
            }
        }
コード例 #6
0
        public void SignalsSessionEnding(int lParam, SessionEndReasons reason)
        {
            bool signaled = false;
            SessionEndingEventArgs    args          = null;
            SessionEndingEventHandler endingHandler = (o, e) =>
            {
                signaled = true;
                args     = e;
            };

            SystemEvents.SessionEnding += endingHandler;

            try
            {
                SendMessage(lParam);
                Assert.True(signaled);
                Assert.NotNull(args);
                Assert.Equal(reason, args.Reason);
            }
            finally
            {
                SystemEvents.SessionEnding -= endingHandler;
            }
        }
コード例 #7
0
 public static void add_SessionEnding(SessionEndingEventHandler value)
 {
 }
コード例 #8
0
 public static void remove_SessionEnding(SessionEndingEventHandler value)
 {
 }
コード例 #9
0
        public static void add_SessionEnding (SessionEndingEventHandler value) {

        }
コード例 #10
0
        public static void remove_SessionEnding (SessionEndingEventHandler value) {

        }