Exemplo n.º 1
0
        public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
        {
            Debugger.Break();
            pdwCookie = 0;

            return(0);
        }
Exemplo n.º 2
0
#pragma warning disable CS0246 // The type or namespace name 'IVsShellPropertyEvents' could not be found (are you missing a using directive or an assembly reference?)
#pragma warning disable CS0246 // The type or namespace name 'IVsShellPropertyEvents' could not be found (are you missing a using directive or an assembly reference?)
        public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
#pragma warning restore CS0246 // The type or namespace name 'IVsShellPropertyEvents' could not be found (are you missing a using directive or an assembly reference?)
#pragma warning restore CS0246 // The type or namespace name 'IVsShellPropertyEvents' could not be found (are you missing a using directive or an assembly reference?)
        {
            _listeners.Add(pSink);
            pdwCookie = (uint)_listeners.Count - 1;
            return(VSConstants.S_OK);
        }
Exemplo n.º 3
0
        public async Task when_subscribing_to_noninitialized_shell_then_can_wait_event_and_completion()
        {
            object zombie = true;
            uint   cookie = 1;
            IVsShellPropertyEvents callback = null;

            var shell = new Mock <IVsShell>();

            shell.Setup(x => x.GetProperty(ZombieProperty, out zombie)).Returns(VSConstants.S_OK);

            var capture = new CaptureMatch <IVsShellPropertyEvents>(s => callback = s);

            shell.Setup(x => x.AdviseShellPropertyChanges(Capture.With(capture), out cookie))
            .Returns(VSConstants.S_OK);

#pragma warning disable VSSDK005 // Avoid instantiating JoinableTaskContext
            var observable = new ShellInitializedObservable(new JoinableLazy <IVsShell>(() => shell.Object, taskFactory: new JoinableTaskContext().Factory));
#pragma warning restore VSSDK005 // Avoid instantiating JoinableTaskContext

            // Callback should have been provided at this point.
            Assert.NotNull(callback);

            var completed         = false;
            ShellInitialized data = null;

            using (observable.Subscribe(e => data = e, () => completed = true))
            {
                Assert.False(completed, "Observable shouldn't have completed yet.");
                Assert.Null(data);

                callback.OnShellPropertyChange(ZombieProperty, false);

                SpinWait.SpinUntil(() => completed, 5000);

                Assert.True(completed, "Observable should have completed already.");
                Assert.NotNull(data);

                shell.Verify(x => x.UnadviseShellPropertyChanges(cookie));

                // Subsequent subscription should get one and complete right away.
                ShellInitialized ev = default;
                observable.Subscribe(e => ev = e);

                Assert.Same(data, ev);
            }
        }
        public async Task when_subscribing_to_noninitialized_shell_then_can_wait_event_and_completion()
        {
            object zombie = true;
            uint   cookie = 1;
            IVsShellPropertyEvents callback = null;

            var shell = new Mock <IVsShell>();

            shell.Setup(x => x.GetProperty(ZombieProperty, out zombie)).Returns(VSConstants.S_OK);

            var capture = new CaptureMatch <IVsShellPropertyEvents>(s => callback = s);

            shell.Setup(x => x.AdviseShellPropertyChanges(Capture.With(capture), out cookie))
            .Returns(VSConstants.S_OK);

            var observable = new ShellInitializedObservable(shell.Object);

            // Callback should have been provided at this point.
            Assert.NotNull(callback);

            var completed         = false;
            ShellInitialized data = null;

            observable.Subscribe(e => data = e, () => completed = true);

            Assert.False(completed, "Observable shouldn't have completed yet.");
            Assert.Null(data);

            callback.OnShellPropertyChange(ZombieProperty, false);

            SpinWait.SpinUntil(() => completed, 5000);

            Assert.True(completed, "Observable should have completed already.");
            Assert.NotNull(data);

            shell.Verify(x => x.UnadviseShellPropertyChanges(cookie));

            // Subsequent subscription should get one and complete right away.

            var ev = await observable;

            Assert.Same(data, ev);
        }
Exemplo n.º 5
0
 public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
 {
     _listeners.Add(pSink);
     pdwCookie = (uint)_listeners.Count - 1;
     return(VSConstants.S_OK);
 }
Exemplo n.º 6
0
 int IVsShell.AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Exemplo n.º 7
0
 public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
 {
     throw new NotImplementedException();
 }
 int IVsShell.AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
 {
     throw new NotImplementedException();
 }
 public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie) {
     pdwCookie = 0;
     return VSConstants.S_OK;
 }
Exemplo n.º 10
0
 public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie) {
     _listeners.Add(pSink);
     pdwCookie = (uint)_listeners.Count - 1;
     return VSConstants.S_OK;
 }
Exemplo n.º 11
0
 public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
 {
     pdwCookie = 0;
     return(VSConstants.S_OK);
 }
Exemplo n.º 12
0
		public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie) {
			pdwCookie = 42;
			return 0;
		}
Exemplo n.º 13
0
 public int AdviseShellPropertyChanges(IVsShellPropertyEvents pSink, out uint pdwCookie)
 {
     pdwCookie = 42;
     return(0);
 }