Example #1
0
        private void UpdateModDetailsList(ModDetailList modDetails)
        {
            if (ModDetails != null)
            {
                ModDetails.CollectionChanged -= ModDetails_CollectionChanged;
            }

            ModDetails = modDetails ?? new ModDetailList();
            if (ModDetails != null)
            {
                ModDetails.CollectionChanged += ModDetails_CollectionChanged;
            }

            ModDetailsView?.Refresh();
        }
Example #2
0
        private async void WriteTimestampMod_Click(object sender, RoutedEventArgs e)
        {
            var mod = ((ModDetail)((Button)e.Source).DataContext);

            if (mod == null)
            {
                return;
            }

            if (MessageBox.Show(_globalizer.GetResourceString("ModDetails_WriteTimestamp_ConfirmLabel"), _globalizer.GetResourceString("ModDetails_WriteTimestamp_ConfirmTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
            {
                return;
            }

            var cursor = this.Cursor;

            try
            {
                Application.Current.Dispatcher.Invoke(() => this.Cursor = System.Windows.Input.Cursors.Wait);
                await Task.Delay(500);

                var file             = ModUtils.GetLatestModTimeFile(_profile?.InstallDirectory, mod.ModId);
                var steamLastUpdated = mod?.TimeUpdated.ToString() ?? string.Empty;
                File.WriteAllText(file, steamLastUpdated);

                mod.PopulateExtended(Path.Combine(_profile.InstallDirectory, Config.Default.ServerModsRelativePath));
                ModDetailsView?.Refresh();
            }
            catch (DirectoryNotFoundException)
            {
                MessageBox.Show(_globalizer.GetResourceString("ModDetails_WriteTimestamp_FailedLabel"), _globalizer.GetResourceString("ModDetails_WriteTimestamp_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, _globalizer.GetResourceString("ModDetails_WriteTimestamp_FailedTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                Application.Current.Dispatcher.Invoke(() => this.Cursor = cursor);
            }
        }
Example #3
0
 private void FilterMods_Click(object sender, RoutedEventArgs e)
 {
     ModDetailsView?.Refresh();
 }
 private void Filter_SourceUpdated(object sender, DataTransferEventArgs e)
 {
     ModDetailsView?.Refresh();
 }