Skip to content

Commit

Permalink
Fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
azeier committed Jun 4, 2017
1 parent e3e8a06 commit 2e58a31
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,23 @@ private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArg

private void SelectPickerClassItem(DeckPickerClassItem dpci)
{
#pragma warning disable IDE0019
var heroClass = dpci.DataContext as HeroClassAll?;
if(heroClass != null && !SelectedClasses.Contains(heroClass.Value))
{
SelectedClasses.Add(heroClass.Value);
dpci.OnSelected();
}
#pragma warning restore IDE0019
}

private void DeselectPickerClassItem(DeckPickerClassItem dpci)
{
#pragma warning disable IDE0019
var heroClass = dpci.DataContext as HeroClassAll?;
if(heroClass != null && SelectedClasses.Remove(heroClass.Value))
dpci.OnDelselected();
#pragma warning restore IDE0019
}

private static IEnumerable<HeroClassAll?> PickerClassItemsAsEnum(IEnumerable<DeckPickerClassItem> items)
Expand Down
4 changes: 3 additions & 1 deletion Hearthstone Deck Tracker/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public static class Core
internal static bool Update { get; set; }
internal static bool CanShutdown { get; set; }

#pragma warning disable 1998
public static async void Initialize()
#pragma warning restore 1998
{
LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US");
_startUpTime = DateTime.UtcNow;
Expand Down Expand Up @@ -134,7 +136,7 @@ public static async void Initialize()
MainWindow.ShowLogConfigUpdateFailedMessage().Forget();
else if(LogConfigUpdater.LogConfigUpdated && Game.IsRunning)
{
MainWindow.ShowMessageAsync("Hearthstone restart required", "The log.config file has been updated. HDT may not work properly until Hearthstone has been restarted.");
MainWindow.ShowMessageAsync("Hearthstone restart required", "The log.config file has been updated. HDT may not work properly until Hearthstone has been restarted.").Forget();
Overlay.ShowRestartRequiredWarning();
}
LogWatcherManger.Start(Game).Forget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class DeckEditorViewModel : ViewModel
private Visibility _saveOperationSelectionVisibility;
private int _selectedDbIndex;
private string _selectedSearchText;
private bool _isNewDeck;

public Action DbInputFocusRequest { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void ButtonOpenPluginsFolder_OnClick(object sender, RoutedEventArgs e)
Helper.TryOpenUrl(dir.FullName);
}

private async void GroupBox_Drop(object sender, DragEventArgs e)
private void GroupBox_Drop(object sender, DragEventArgs e)
{
var dir = PluginManager.PluginDirectory.FullName;
try
Expand Down
6 changes: 5 additions & 1 deletion Hearthstone Deck Tracker/Utility/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public Command(Action action)

public void Execute(object parameter) => _action.Invoke();

#pragma warning disable 67
public event EventHandler CanExecuteChanged;
#pragma warning restore 67
}

public class Command<T> : ICommand
Expand All @@ -27,8 +29,10 @@ public Command(Action<T> action)
{
_action = action;
}


#pragma warning disable 67
public event EventHandler CanExecuteChanged;
#pragma warning restore 67

public bool CanExecute(object parameter) => _action != null;

Expand Down
6 changes: 4 additions & 2 deletions Hearthstone Deck Tracker/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal void ShowReplayFromFileDialog()
};
var dialogResult = dialog.ShowDialog();
if(dialogResult == System.Windows.Forms.DialogResult.OK)
ReplayLauncher.ShowReplay(dialog.FileName, true);
ReplayLauncher.ShowReplay(dialog.FileName, true).Forget();
}
catch(Exception ex)
{
Expand Down Expand Up @@ -478,7 +478,7 @@ public void SelectDeck(Deck deck, bool setActive)

Log.Info($"Switched to deck: {deck.Name} ({deck.SelectedVersion.ShortVersionString})");

int useNoDeckMenuItem = Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey(TrayIcon.UseNoDeckMenuItemName);
var useNoDeckMenuItem = Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey(TrayIcon.UseNoDeckMenuItemName);
Core.TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Checked = false;
}

Expand Down Expand Up @@ -586,7 +586,9 @@ public void ShowDeckEditorFlyout(Deck deck, bool isNewDeck)
public void SetNewDeck(Deck deck, bool edit) => ShowDeckEditorFlyout(deck, !edit);

[Obsolete("Use DeckManager.SaveDeck", true)]
#pragma warning disable 1998
public async void SaveDeck(bool overwrite, SerializableVersion newVersion, bool workInProgressDeck = false)
#pragma warning disable 1998
{
}

Expand Down

0 comments on commit 2e58a31

Please sign in to comment.