Example #1
0
 public static void RaiseSelectedNodeChanged(UiNode node)
 {
     try
     {
         SelectedLeafChanged.NullSafeInvoke(node as IUiLeaf);
     }
     catch (Exception ex)
     {
         UiHelper.ShowError(Application.Current.MainWindow, ex);
     }
 }
Example #2
0
 private void OnClosing(object sender, CancelEventArgs e)
 {
     try
     {
         Directory.CreateDirectory(ApplicationConfigInfo.ConfigurationDirectory);
         _layoutSerializer.Serialize(ApplicationConfigInfo.LayoutConfigurationFilePath);
     }
     catch (Exception ex)
     {
         UiHelper.ShowError(this, ex);
     }
 }
Example #3
0
        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);
            }
        }
Example #4
0
 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);
     }
 }
Example #5
0
        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);
            }
        }
Example #6
0
 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());
        }
Example #8
0
        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);
            }
        }
Example #9
0
        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);
            }
        }