Skip to content

Commit

Permalink
Fixed page reset bug By @AlperAkca79 in #6
Browse files Browse the repository at this point in the history
  • Loading branch information
lnxwizard committed Mar 2, 2023
1 parent b78ab34 commit ba7fcf6
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 228 deletions.
2 changes: 1 addition & 1 deletion src/SkyNotepad/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="AlperAkca79.SkyNotepad"
Publisher="CN=AlperAkca79"
Version="0.8.5.0" />
Version="0.8.8.0" />

<mp:PhoneIdentity PhoneProductId="778ade44-7283-4a36-a7ba-ecd392206e35" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
4 changes: 2 additions & 2 deletions src/SkyNotepad/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
// 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.8.5.0")]
[assembly: AssemblyFileVersion("0.8.5.0")]
[assembly: AssemblyVersion("0.8.8.0")]
[assembly: AssemblyFileVersion("0.8.8.0")]
[assembly: ComVisible(false)]
12 changes: 3 additions & 9 deletions src/SkyNotepad/SkyNotepad.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@
<Compile Include="ViewModels\MainViewModel.cs" />
<Compile Include="ViewModels\ScreenViewModel.cs" />
<Compile Include="ViewModels\SettingsPageViewModel.cs" />
<Compile Include="ViewModels\WebSearchViewModel.cs" />
<Compile Include="Views\Dialogs\AboutDialog.xaml.cs">
<DependentUpon>AboutDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -220,10 +216,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Views\Dialogs\AboutDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -255,7 +247,9 @@
<Version>2.8.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Views\Dialogs\" />
</ItemGroup>
<ItemGroup>
<None Include="SkyNotepad_TemporaryKey.pfx" />
<PRIResource Include="Strings\en-US\Resources.resw" />
Expand Down
16 changes: 11 additions & 5 deletions src/SkyNotepad/ViewModels/FileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,30 @@ public FileViewModel(DocumentModel _document)
/// </summary>
private void CreateNewFile()
{
Document.FileName = "Untitled";
Document.FileName = "Untitled.txt";
Document.FilePath = string.Empty;
Document.Text = string.Empty;
Document.IsSaved = false;
Document.DateCreated = string.Empty;
Document.AppTitle = Document.FileName + " - SkyNotepad Preview";
}

// New Command
/// <summary>
/// Create new file
/// </summary>
private void NewFile()
{
Document.FileName = "Untitled";
Document.FileName = "Untitled.txt";
Document.FilePath = string.Empty;
Document.Text = string.Empty;
Document.IsSaved = false;
Document.DateCreated = string.Empty;
Document.AppTitle = Document.FileName + " - SkyNotepad Preview";
}

// Save Command
/// <summary>
/// Save current file
/// </summary>
private async void SaveFile()
{
if (Document.IsSaved == true)
Expand All @@ -80,7 +84,9 @@ private async void SaveFile()

}

// Save As Command
/// <summary>
/// Save copy of current file
/// </summary>
private async void SaveFileAs()
{
try
Expand Down
34 changes: 3 additions & 31 deletions src/SkyNotepad/ViewModels/HelpViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// Librarys
using System;
using System.Windows.Input;
using Windows.System;

// From Project
using SkyNotepad.Helpers;
using SkyNotepad.Views.Dialogs;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
using SkyNotepad.Views.Settings;
Expand All @@ -15,42 +12,17 @@ namespace SkyNotepad.ViewModels
public class HelpViewModel
{
// Help Menu Items
public ICommand RepositoryCommand { get; }
public ICommand CreateIssueCommand { get; }
public ICommand ViewLicenseCommand { get; }
public ICommand SettingsCommand { get; }

// Main Method
public HelpViewModel()
{
SettingsCommand = new RelayCommand(ViewSettings);
RepositoryCommand = new RelayCommand(OpenRepository);
CreateIssueCommand = new RelayCommand(CreateIssue);
ViewLicenseCommand = new RelayCommand(ViewLicense);
}

// Repository
private async void OpenRepository()
{
Uri repoUri = new Uri("https://github.com/AlperAkca79/SkyNotepad");
await Launcher.LaunchUriAsync(repoUri);
}

// Create Issue on GitHub
private async void CreateIssue()
{
Uri createIssueUri = new Uri("https://github.com/AlperAkca79/SkyNotepad/issues/new");
await Launcher.LaunchUriAsync(createIssueUri);
}

// View License
private async void ViewLicense()
{
Uri viewLicenseUri = new Uri("https://github.com/AlperAkca79/SkyNotepad/blob/master/LICENSE");
await Launcher.LaunchUriAsync(viewLicenseUri);
}

// Settings
/// <summary>
/// Opens Settings menu
/// </summary>
private void ViewSettings()
{
if (Window.Current.Content is Frame rootFrame)
Expand Down
2 changes: 0 additions & 2 deletions src/SkyNotepad/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class MainViewModel
// View Model(s)
public FileViewModel File { get; set; }
public FormatViewModel Format { get; set; }
public WebSearchViewModel WebSearch { get; set; }
public ScreenViewModel Screen { get; set; }
public HelpViewModel Help { get; set; }
public SettingsPageViewModel SettingsPage { get; set; }
Expand All @@ -22,7 +21,6 @@ public MainViewModel()
Document = new DocumentModel();
File = new FileViewModel(Document);
Format = new FormatViewModel(Document);
WebSearch = new WebSearchViewModel();
Screen = new ScreenViewModel();
Help = new HelpViewModel();
SettingsPage = new SettingsPageViewModel();
Expand Down
31 changes: 0 additions & 31 deletions src/SkyNotepad/ViewModels/WebSearchViewModel.cs

This file was deleted.

43 changes: 0 additions & 43 deletions src/SkyNotepad/Views/Dialogs/AboutDialog.xaml

This file was deleted.

38 changes: 0 additions & 38 deletions src/SkyNotepad/Views/Dialogs/AboutDialog.xaml.cs

This file was deleted.

21 changes: 1 addition & 20 deletions src/SkyNotepad/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" RequestedTheme="Light"
mc:Ignorable="d" RequestedTheme="Light" NavigationCacheMode="Required"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:viewmodel="using:SkyNotepad.ViewModels" Loaded="MainPage_Loaded"
Expand Down Expand Up @@ -143,25 +143,6 @@
</MenuFlyoutItem.KeyboardAccelerators>
</MenuFlyoutItem>
</muxc:MenuBarItem>

<!-- Help Menu -->
<muxc:MenuBarItem x:Name="MenuHelp" x:Uid="MenuHelp" Title="Help" DataContext="{Binding Help}">
<MenuFlyoutItem x:Name="MenuItemRepository" x:Uid="MenuItemRepository" Text="Repository" Command="{Binding RepositoryCommand}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xe82d;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem x:Name="MenuItemViewLicense" x:Uid="MenuItemViewLicense" Text="License" Command="{Binding ViewLicenseCommand}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xe729;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem x:Name="MenuItemCreateIssue" x:Uid="MenuItemCreateIssue" Text="Report an Issue" Command="{Binding CreateIssueCommand}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE730;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</muxc:MenuBarItem>
</muxc:MenuBar>

<Grid x:Name="DragRegion" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="48" Background="Transparent" Loaded="DragRegion_Loaded"/>
Expand Down
7 changes: 5 additions & 2 deletions src/SkyNotepad/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Windows.ApplicationModel.Activation;

// From Project
using SkyNotepad.Views.Dialogs;
using SkyNotepad.ViewModels;
using SkyNotepad.Models;

Expand Down Expand Up @@ -131,7 +130,11 @@ private void MenuItemTimeDate_Click(object sender, RoutedEventArgs e)
TextBox.SelectedText = dateTime.ToString();
}

// Spell Check Command
/// <summary>
/// Toggle Spell Checking feature
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MenuItemSpellCheck_Click(object sender, RoutedEventArgs e)
{
if (MenuItemSpellCheck.IsChecked == true)
Expand Down
Loading

0 comments on commit ba7fcf6

Please sign in to comment.