public static void RaiseSelectedNodeChanged(UiNode node) { try { SelectedLeafChanged.NullSafeInvoke(node as IUiLeaf); } catch (Exception ex) { UiHelper.ShowError(Application.Current.MainWindow, ex); } }
private void OnClosing(object sender, CancelEventArgs e) { try { Directory.CreateDirectory(ApplicationConfigInfo.ConfigurationDirectory); _layoutSerializer.Serialize(ApplicationConfigInfo.LayoutConfigurationFilePath); } catch (Exception ex) { UiHelper.ShowError(this, ex); } }
private async void OnLoaded(object sender, RoutedEventArgs e) { try { await RefreshContent(InteractionService.GameLocation.Provide()); InteractionService.GameLocation.InfoLost += ClearContent; InteractionService.GameLocation.InfoProvided += async v => await RefreshContent(v); } catch (Exception ex) { ClearContent(); UiHelper.ShowError(this, ex); } }
private void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { try { UiContainerNode item = (UiContainerNode)_treeView.SelectedItem; if (item != null) { _listView.ItemsSource = item.BindableChilds; } } catch (Exception ex) { UiHelper.ShowError(this, ex); } }
private void OnLoaded(object sender, RoutedEventArgs e) { try { if (!File.Exists(ApplicationConfigInfo.LayoutConfigurationFilePath)) { return; } _layoutSerializer.Deserialize(ApplicationConfigInfo.LayoutConfigurationFilePath); } catch (Exception ex) { UiHelper.ShowError(this, ex); } }
private void Refresh() { try { _listView.ItemsSource = new[] { UiDataProviderNode.Create(InteractionService.Configuration), UiDataProviderNode.Create(InteractionService.GameLocation), UiDataProviderNode.Create(InteractionService.WorkingLocation), UiDataProviderNode.Create(InteractionService.TextEncoding) }; } catch (Exception ex) { UiHelper.ShowError(this, ex); } }
public void Execute(object parameter) { if (Interlocked.Exchange(ref _canExecute, 0) != 1) { return; } CanExecuteChanged.NullSafeInvoke(this, new EventArgs()); try { _action.Invoke(); } catch (Exception ex) { UiHelper.ShowError(null, ex); } Interlocked.Exchange(ref _canExecute, 1); CanExecuteChanged.NullSafeInvoke(this, new EventArgs()); }
private void ClearContent() { try { if (CheckAccess()) { _treeView.ItemsSource = null; _listView.ItemsSource = null; IsEnabled = false; } else { Dispatcher.Invoke(ClearContent); } } catch (Exception ex) { UiHelper.ShowError(this, ex); } }
private async Task RefreshContent(GameLocationInfo obj) { try { if (CheckAccess()) { _treeNodes = await obj.ArchivesTree; _treeView.ItemsSource = _treeNodes; SelectNode(); IsEnabled = true; } else { await Dispatcher.Invoke(async() => await RefreshContent(obj)); } } catch (Exception ex) { ClearContent(); UiHelper.ShowError(this, ex); } }