Skip to content

Commit

Permalink
VMHome移除冗余
Browse files Browse the repository at this point in the history
  • Loading branch information
zsh2401 committed Feb 18, 2019
1 parent c67a5ce commit 8f2657b
Showing 1 changed file with 0 additions and 135 deletions.
135 changes: 0 additions & 135 deletions AutumnBox.GUI/ViewModel/VMHome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,96 +50,6 @@ public ICommand ViewOpenSource
}
private ICommand _os;

public string MOTDTitle
{
get => _motdTitle; set
{
_motdTitle = value;
RaisePropertyChanged();
}
}
private string _motdTitle;

public string MOTD
{
get => _motd; set
{
_motd = value;
RaisePropertyChanged();
}
}
private string _motd;

public string POTDTitle
{
get => _potdTitle; set
{
_potdTitle = value;
RaisePropertyChanged();
}
}
private string _potdTitle;

public byte[] POTD
{
get => _potd; set
{
_potd = value;
RaisePropertyChanged();
}
}
private byte[] _potd;

public string POTDTarget
{
get => _potdTarget; set
{
_potdTarget = value;
RaisePropertyChanged();
}
}
private string _potdTarget;

public Visibility PotdVisibility
{
get => _potdVisi; set
{
_potdVisi = value;
RaisePropertyChanged();
}
}
private Visibility _potdVisi = Visibility.Collapsed;

public Visibility MotdVisibility
{
get => _motdVisi; set
{
_motdVisi = value;
RaisePropertyChanged();
}
}
private Visibility _motdVisi = Visibility.Collapsed;

public Visibility PotdTitleVisibility
{
get => _potdTitleVisi; set
{
_potdTitleVisi = value;
RaisePropertyChanged();
}
}
private Visibility _potdTitleVisi = Visibility.Collapsed;

public Visibility MotdTitleVisibility
{
get => _motdTitleVisi; set
{
_motdTitleVisi = value;
RaisePropertyChanged();
}
}
private Visibility _motdTitleVisi = Visibility.Collapsed;

public VMHome()
{
RaisePropertyChangedOnDispatcher = true;
Expand All @@ -151,51 +61,6 @@ public VMHome()
{
(App.Current.MainWindow as MainWindow).DialogHost.ShowDialog(new ContentOpenSource());
});
InitPotd();
InitMotd();
}

private void InitPotd()
{
new PotdV2Getter().Advance().ContinueWith((task) =>
{
if (!task.IsFaulted)
{
POTDTitle = task.Result.Title;
POTDTarget = task.Result.ClickTarget;
POTD = task.Result.Image;
PotdTitleVisibility = task.Result.TitleEnable ? Visibility.Visible : Visibility.Collapsed;
PotdVisibility = task.Result.Enable ? Visibility.Visible : Visibility.Collapsed;
}
else
{
POTDTitle = "....";
POTD = null;
PotdVisibility = Visibility.Collapsed;
SLogger<VMHome>.Warn("Can not get POTD", task.Exception);
}
});
}

private void InitMotd()
{
new MotdV2Getter().Advance().ContinueWith((task) =>
{
if (!task.IsFaulted)
{
MOTDTitle = task.Result.Title;
MOTD = task.Result.Content;
MotdTitleVisibility = task.Result.TitleEnable ? Visibility.Visible : Visibility.Collapsed;
MotdVisibility = task.Result.Enable ? Visibility.Visible : Visibility.Collapsed;
}
else
{
MOTDTitle = "...";
MOTD = "........";
MotdVisibility = Visibility.Collapsed;
SLogger<VMHome>.Warn("Can not get MOTD", task.Exception);
}
});
}
}
}

0 comments on commit 8f2657b

Please sign in to comment.