private void btnFree_Click_1(object sender, RoutedEventArgs e) { switch (counter) { case 0: if (s1 != null) { s1 = null; ds1.Dispose(); ds1 = null; GC.Collect(); } break; case 1: s2 = null; ds2.Dispose(); ds2 = null; GC.Collect(); counter--; break; case 2: s3 = null; ds3.Dispose(); ds3 = null; GC.Collect(); counter--; break; default: return; } }
private void btnAlloc_Click_1(object sender, RoutedEventArgs e) { switch (counter) { case 0: if (s1 == null) { counter++; s1 = new Subscriber1(); ds1 = DefaultSingleton <ActionMessageBus> .Instance.Subscribe <Message1>(s1.Handle); } break; case 1: counter++; s2 = new Subscriber2(); ds2 = DefaultSingleton <ActionMessageBus> .Instance.Subscribe <Message1>(s2.Handle); break; case 2: if (s3 == null) { s3 = new Subscriber3(); ds3 = DefaultSingleton <ActionMessageBus> .Instance.Subscribe <Message1>(s3.Handle); } break; default: return; } }
private void btnAlloc_Click_1(object sender, RoutedEventArgs e) { switch (counter) { case 0: if (s1 == null) { counter++; s1 = new Subscriber1(); ds1 = DefaultSingleton<ActionMessageBus>.Instance.Subscribe<Message1>(s1.Handle); } break; case 1: counter++; s2 = new Subscriber2(); ds2 = DefaultSingleton<ActionMessageBus>.Instance.Subscribe<Message1>(s2.Handle); break; case 2: if (s3 == null) { s3 = new Subscriber3(); ds3 = DefaultSingleton<ActionMessageBus>.Instance.Subscribe<Message1>(s3.Handle); } break; default: return; } }