Skip to content

Commit

Permalink
Hotfix (crash on startup should be fixed now)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackTasty committed Jul 31, 2018
1 parent 86f2674 commit 26d12c1
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 17 deletions.
5 changes: 1 addition & 4 deletions Osmo/Core/Configuration/AppConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public void Save()
public void Load()
{
Content = base.LoadFile(this);
LoadDefaults();

if (Content != null)
{
Expand Down Expand Up @@ -197,10 +198,6 @@ public void Load()
}
}
}
else
{
LoadDefaults();
}

UnsavedChanges = false;
OnSettingsLoaded(EventArgs.Empty);
Expand Down
5 changes: 1 addition & 4 deletions Osmo/Core/Configuration/RecallConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public void Save()
public void Load()
{
Content = base.LoadFile(this);
LoadDefaults();

if (Content != null)
{
Expand Down Expand Up @@ -96,10 +97,6 @@ public void Load()
}
}
}
else
{
LoadDefaults();
}
}

private void LoadDefaults()
Expand Down
15 changes: 11 additions & 4 deletions Osmo/Core/Objects/SkinElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ public class SkinElement : ViewModelBase
private bool mIsResizeSelected;
private FontStyle fontStyle = FontStyles.Normal;
private FontWeight fontWeight = FontWeights.Normal;
string backupPath = Directory.GetParent(AppConfiguration.Instance.BackupDirectory).FullName +
"\\Edited\\";
string backupPath;

public string Path
{
get => !string.IsNullOrWhiteSpace(TempPath) ? TempPath : mPath;
get
{
return !string.IsNullOrWhiteSpace(TempPath) ? TempPath : mPath;
}
set => mPath = value;
}

Expand Down Expand Up @@ -85,7 +87,8 @@ internal SkinElement(FileInfo fi, string skinName)
Path = fi.FullName;
Name = fi.Name;
Extension = fi.Extension;
backupPath += skinName + "\\";
backupPath = string.Format("{0}\\Edited\\{1}\\",
Directory.GetParent(AppConfiguration.Instance.BackupDirectory).FullName, skinName);

fileType = GetFileType(fi.Extension);

Expand Down Expand Up @@ -121,6 +124,10 @@ internal SkinElement(FileInfo fi, string skinName)
TempPath = backupPath + Name;
FontStyle = FontStyles.Italic;
}
else
{
TempPath = "";
}
}

internal SkinElement(SkinElement copyFrom)
Expand Down
1 change: 1 addition & 0 deletions Osmo/Core/SkinManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private void LoadSkins()
Skins.Clear();
}

Skins.Add(new Skin());
RecallConfiguration recall = RecallConfiguration.Instance;
bool reopenLastSkin = AppConfiguration.Instance.ReopenLastSkin;
new Thread(() =>
Expand Down
4 changes: 2 additions & 2 deletions Osmo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.3.85")]
[assembly: AssemblyFileVersion("0.0.3.85")]
[assembly: AssemblyVersion("0.0.3.94")]
[assembly: AssemblyFileVersion("0.0.3.94")]
2 changes: 1 addition & 1 deletion Osmo/UI/SkinMixerSelect.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource mixer_selectRightSkin}" Style="{StaticResource MaterialDesignTitleTextBlock}"/>

<ListView x:Name="lv_skins" SelectionMode="Single" ItemsSource="{Binding Skins}"
<ListView x:Name="lv_skins" SelectionMode="Single" ItemsSource="{Binding SkinsMixer}"
PreviewMouseDoubleClick="Skins_PreviewMouseDoubleClick" Grid.Row="2">
<ListView.View>
<GridView>
Expand Down
2 changes: 1 addition & 1 deletion Osmo/UI/SkinSelect.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<ProgressBar Value="{Binding SkinManager.SkinLoadCurrent}"
Maximum="{Binding SkinManager.SkinLoadMaximum}"/>
</StackPanel>
<ListView x:Name="lv_skins" SelectionMode="Single" ItemsSource="{Binding Skins}"
<ListView x:Name="lv_skins" SelectionMode="Single" ItemsSource="{Binding Skins}" SelectedIndex="{Binding SelectedIndex}"
PreviewMouseDoubleClick="Skins_PreviewMouseDoubleClick" PreviewMouseLeftButtonUp="Skins_PreviewMouseLeftButtonUp">
<ListView.View>
<GridView>
Expand Down
36 changes: 36 additions & 0 deletions Osmo/UI/SkinSelect.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,41 @@ private async void Grid_PreviewKeyUp(object sender, KeyEventArgs e)
{
await ForwardKeyboardInput(e);
}

private void MenuItem_NewSkin_Click(object sender, RoutedEventArgs e)
{
if (DialogHost.OpenDialogCommand.CanExecute(btn_newSkin.CommandParameter, btn_newSkin))
DialogHost.OpenDialogCommand.Execute(btn_newSkin.CommandParameter, btn_newSkin);
}

private void MenuItem_OpenInExplorer_Click(object sender, RoutedEventArgs e)
{

}

private void MenuItem_OpenInMixer_Click(object sender, RoutedEventArgs e)
{

}

private void MenuItem_OpenInEditor_Click(object sender, RoutedEventArgs e)
{

}

private void MenuItem_ResizeTool_Click(object sender, RoutedEventArgs e)
{

}

private void MenuItem_Export_Click(object sender, RoutedEventArgs e)
{

}

private void MenuItem_Delete_Click(object sender, RoutedEventArgs e)
{

}
}
}
22 changes: 21 additions & 1 deletion Osmo/ViewModel/SkinSelectViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Osmo.ViewModel
class SkinSelectViewModel : ViewModelBase
{
private SkinManager mSkinManager;
private int mSelectedIndex;

public SkinSelectViewModel()
{
Expand All @@ -22,13 +23,32 @@ public SkinSelectViewModel()
private void SkinManager_SkinDirectoryChanged(object sender, EventArgs e)
{
InvokePropertyChanged("Skins");
InvokePropertyChanged("SkinsMixer");
}

public SkinManager SkinManager
{
get => mSkinManager;
}

public List<Skin> Skins { get => SkinManager != null ? SkinManager.Skins.SkipWhile(x => x.IsEmpty).ToList() : null; }
public int SelectedIndex
{
get => mSelectedIndex;
set
{
mSelectedIndex = value;
InvokePropertyChanged("SelectedIndex");
InvokePropertyChanged("SkinOptionsEnabled");
}
}

public bool SkinOptionsEnabled
{
get => SelectedIndex > 0;
}

public List<Skin> Skins { get => SkinManager != null ? SkinManager.Skins.ToList() : null; }

public List<Skin> SkinsMixer { get => SkinManager != null ? SkinManager.Skins.SkipWhile(x => x.IsEmpty).ToList() : null; }
}
}

0 comments on commit 26d12c1

Please sign in to comment.