private async void AcceptButton_Click(object sender, RoutedEventArgs e) { AcceptButton.Visibility = Visibility.Collapsed; MainContent.IsEnabled = false; ProgressRing.IsActive = true; await _viewModel.SaveChangesAsync(); ProgressRing.IsActive = false; OverlayService.GetForCurrentView().CloseOverlay(); }
public void Execute(object parameter) { if (parameter is DiscordChannel channel) { var page = Window.Current.Content.FindChild <DiscordPage>(); if (page != null) { OverlayService.GetForCurrentView().ShowOverlay <ChannelEditPage>(channel); } } }
private async Task ChangeImpl() { var selectEffect = new SelectEffectView(); var effect = await OverlayService.Show <Effect>(selectEffect); if (effect == null) { return; } Effect.Effect.Value = effect.Id; }
public void Execute(object parameter) { if (parameter is DiscordChannel channel) { var page = Window.Current.Content.FindChild <DiscordPage>(); if (page != null) { Analytics.TrackEvent("EditChannelCommand_Invoked"); OverlayService.GetForCurrentView().ShowOverlay <ChannelEditPage>(channel); } } }
public void Show(SplashScreen splashScreen, Func <SplashScreen, UserControl> splashFactory, WindowLogic window) { if (splashFactory == null) { return; } var splash = splashFactory(splashScreen); var service = new OverlayService(); popup = service.Show(Sizes.FullScreen, splash); window.Activate(WindowLogic.ActivateSources.SplashScreen, this); }
public async Task<bool> AddOverlay(string name, int port) { IOverlayService overlay = new OverlayService(name, port); if (await overlay.Initialize()) { overlay.OnWebSocketConnectedOccurred += Overlay_OnWebSocketConnectedOccurred; overlay.OnWebSocketDisconnectedOccurred += Overlay_OnWebSocketDisconnectedOccurred; this.overlays[name] = overlay; return true; } await this.RemoveOverlay(name); return false; }
private void EditButton_Click(object sender, RoutedEventArgs e) { var bigModel = DataContext as ChannelViewModel; var model = (sender as FrameworkElement).DataContext as FileUploadModel; var newModel = new EditedFileUploadModel(model) { Parent = this }; bigModel.FileUploads.Remove(model); bigModel.FileUploads.Add(newModel); OverlayService.GetForCurrentView().ShowOverlay <VideoEditor>(newModel); }
/// <summary> /// Dispose the SDK instance, don't miss this after SDK usage. /// </summary> public void Dispose() { Subscriber?.Dispose(); Subscriber = null; Storage?.Dispose(); Storage = null; RuyiNetService?.Dispose(); RuyiNetService = null; SettingSys?.Dispose(); SettingSys = null; L10NService?.Dispose(); L10NService = null; UserService?.Dispose(); UserService = null; InputMgr?.Dispose(); InputMgr = null; SpeechService?.Dispose(); SpeechService = null; Media?.Dispose(); Media = null; OverlayService?.Dispose(); OverlayService = null; lowLatencyTransport?.Close(); LowLatencyProtocol?.Dispose(); lowLatencyTransport = null; LowLatencyProtocol = null; highLatencyTransport?.Close(); HighLatencyProtocol?.Dispose(); HighLatencyProtocol = null; highLatencyTransport = null; InstanceCount--; if (InstanceCount <= 0) { factory.SDKCleanup(); } }
private async Task AddItemImpl() { try { var selectItem = new SelectItemView(); var item = await OverlayService.Show <Item>(selectItem); if (item != null) { await ShopService.Instance.NewItem(item.ItemNumber); } } catch (Exception ex) { await new MessageView("Error", "Unable to add item", ex).ShowDialog(Application.Current.MainWindow); } }
public void posts_overlay_without_lifetime() { // ARRANGE var contentViewModel = new Mock <BaseViewModel>(); var service = new OverlayService(); OverlayViewModel overlayViewModel = null; service.Show.Subscribe(x => overlayViewModel = x); // ACT service.Post("header 1", contentViewModel.Object, null); // ASSERT Assert.That(overlayViewModel.HasLifetime, Is.False); Assert.That(overlayViewModel.Lifetime, Is.Null); Assert.That(overlayViewModel.Header, Is.EqualTo("header 1")); Assert.That(overlayViewModel.ViewModel, Is.EqualTo(contentViewModel.Object)); }
public StreamerViewModel(string name) { LoadingValue = 0; IsLoading = true; infoViewModel = new InfoViewModel(); WindowManager = new WindowManager(); ItemPaths = new ObservableCollection <string>(); SmallItemPaths = new ObservableCollection <string>(); while (ItemPaths.Count < 16) { ItemPaths.Add("/Icons/null.png"); } while (SmallItemPaths.Count < 16) { SmallItemPaths.Add("/Icons/null.png"); } OverlayService.GetInstance().Show = (str) => { OverlayService.GetInstance().Text = str; }; UpdateInfo(name); }
internal static async Task LogoutAsync() { await WebView.ClearTemporaryWebDataAsync(); await WindowingService.Current.CloseAllWindowsAsync(); await ImageCache.Instance.ClearAsync(); await Discord.DisconnectAsync(); Discord.Dispose(); Discord = null; try { var passwordVault = new PasswordVault(); foreach (var c in passwordVault.FindAllByResource(TOKEN_IDENTIFIER)) { passwordVault.Remove(c); } } catch { } DiscordNavigationService.Reset(); FullscreenService.Reset(); OverlayService.Reset(); SettingsService.Reset(); SwipeOpenService.Reset(); var frame = (Window.Current.Content as Frame); frame.Navigate(typeof(Page)); frame.BackStack.Clear(); frame.ForwardStack.Clear(); frame = new Frame(); frame.Navigate(typeof(MainPage)); Window.Current.Content = frame; }
public MainWindowViewModel() { OverlayService.GetInstance().Show = (str) =>//инициализация оверлея { OverlayService.GetInstance().Text = str; }; Articles = new ObservableCollection <Article>(); Parser = new ParserWorker <Article[]>(new HabrParser()); //По заврешению работы парсера будет появляться уведомляющее окно. Parser.OnComplited += (obj) => { MessageBoxNotification.Show("Парсер сделал обработку данных.\nДанные готовы для сохранения в файл.\nДля этого слева боковая панель пукт Сохранение.", 5); }; //Заполняем наш listBox заголовками Parser.OnNewData += (object o, Article[] item) => { foreach (var i in item) { Articles.Add(new Article(i.Title, i.Text, i.Image)); } }; }
public MainViewModel() { OverlayService.GetInstance().Show = delegate(string str, string str1) { OverlayService.GetInstance().Text = str; OverlayService.GetInstance().Description = str1; }; Items = File.Exists("Data/Items.json") ? JsonConvert.DeserializeObject <ObservableCollection <Item> >( Crypter.Decrypt(File.ReadAllText("Data/Items.json"), true)) : new ObservableCollection <Item>(); Items.CollectionChanged += (s, e) => { if (!File.Exists("Data")) { Directory.CreateDirectory("Data"); } File.WriteAllText("Data/Items.json", Crypter.Encrypt(JsonConvert.SerializeObject(Items), true)); }; Messenger.Default.Register <Message>(this, OnMessage); }
private async void Close() { OverlayService.GetForCurrentView().CloseOverlay(); mediaElement.Source = null; _mediaStreamSource = null; _playTimer?.Stop(); _model = null; _renderTask = null; _tempFile = null; if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait; await StatusBar.GetForCurrentView().ShowAsync(); } else { DisplayInformation.AutoRotationPreferences = DisplayOrientations.None; } GC.Collect(); }
private void SelectImpl() { OverlayService.Close(SelectedEffect.Value); }
private void NavigationView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) { OverlayService.GetForCurrentView().CloseOverlay(); }
private async void Close() { OverlayService.GetForCurrentView().CloseOverlay(); DoCleanup(); }
private void CancelImpl() { OverlayService.Close(); }
private void BackButton_Click(object sender, RoutedEventArgs e) { OverlayService.GetForCurrentView().CloseOverlay(); }
/// <summary> /// Dispose the SDK instance, don't miss this after SDK usage. /// </summary> public void Dispose() { Subscriber?.Dispose(); Subscriber = null; Storage?.Dispose(); Storage = null; RuyiNetService?.Dispose(); RuyiNetService = null; SettingSys?.Dispose(); SettingSys = null; L10NService?.Dispose(); L10NService = null; UserService?.Dispose(); UserService = null; InputMgr?.Dispose(); InputMgr = null; SpeechService?.Dispose(); SpeechService = null; Media?.Dispose(); Media = null; OverlayService?.Dispose(); OverlayService = null; lowLatencyTransport?.Close(); LowLatencyProtocol?.Dispose(); lowLatencyTransport = null; LowLatencyProtocol = null; highLatencyTransport?.Close(); HighLatencyProtocol?.Dispose(); HighLatencyProtocol = null; highLatencyTransport = null; // don't clean up netmq in layer0. InstanceCount--; if (InstanceCount <= 0) { var entry = Assembly.GetEntryAssembly(); if (entry == null) // in a unit test { NetMQConfig.Cleanup(false); return; } // not Layer0 & not Layer1 if (!entry.FullName.StartsWith("Layer0,", StringComparison.OrdinalIgnoreCase) && !entry.FullName.StartsWith("zpLayer1,", StringComparison.OrdinalIgnoreCase)) { NetMQConfig.Cleanup(false); return; } } }