Added option to open database directory
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
|
||||||
using SQLite.Net.Attributes;
|
using SQLite.Net.Attributes;
|
||||||
using SQLiteNetExtensions.Attributes;
|
using SQLiteNetExtensions.Attributes;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
<Menu DockPanel.Dock="Top">
|
<Menu DockPanel.Dock="Top">
|
||||||
<MenuItem Header="Menu">
|
<MenuItem Header="Menu">
|
||||||
<MenuItem Header="_Switch Database" Command="{Binding SwitchDatabaseMenuCommand}" />
|
<MenuItem Header="_Switch Database" Command="{Binding SwitchDatabaseMenuCommand}" />
|
||||||
|
<MenuItem Header="_Open Database location" Command="{Binding OpenDatabaseLocationMenuCommand}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using DebtMgr.Model;
|
using DebtMgr.Model;
|
||||||
using GalaSoft.MvvmLight;
|
using GalaSoft.MvvmLight;
|
||||||
@@ -16,7 +13,7 @@ namespace DebtMgr.ViewModel.Dialogs
|
|||||||
public class DatabaseSelectorDialogViewModel : ViewModelBase
|
public class DatabaseSelectorDialogViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
public event EventHandler RequestClose;
|
public event EventHandler RequestClose;
|
||||||
public bool ProgramRequestedClose = false;
|
public bool ProgramRequestedClose;
|
||||||
|
|
||||||
#region SelectDatabasePathText (string) Property
|
#region SelectDatabasePathText (string) Property
|
||||||
|
|
||||||
@@ -55,9 +52,11 @@ namespace DebtMgr.ViewModel.Dialogs
|
|||||||
|
|
||||||
private void SelectDatabaseButtonClick_Execute()
|
private void SelectDatabaseButtonClick_Execute()
|
||||||
{
|
{
|
||||||
var openFileDialog = new OpenFileDialog();
|
var openFileDialog = new OpenFileDialog
|
||||||
openFileDialog.CheckFileExists = true;
|
{
|
||||||
openFileDialog.Filter = "Debt Manager Database|*.dmdb|All files|*.*";
|
CheckFileExists = true,
|
||||||
|
Filter = "Debt Manager Database|*.dmdb|All files|*.*"
|
||||||
|
};
|
||||||
|
|
||||||
//Application.Current.Shutdown();
|
//Application.Current.Shutdown();
|
||||||
|
|
||||||
@@ -106,9 +105,11 @@ namespace DebtMgr.ViewModel.Dialogs
|
|||||||
|
|
||||||
private void CreateDatabaseButtonClick_Execute()
|
private void CreateDatabaseButtonClick_Execute()
|
||||||
{
|
{
|
||||||
var saveFileDialog = new SaveFileDialog();
|
var saveFileDialog = new SaveFileDialog
|
||||||
saveFileDialog.Filter = "Debt Manager Database|*.dmdb|Standard database|*.db";
|
{
|
||||||
saveFileDialog.CreatePrompt = true;
|
Filter = "Debt Manager Database|*.dmdb|Standard database|*.db",
|
||||||
|
CreatePrompt = true
|
||||||
|
};
|
||||||
|
|
||||||
if (saveFileDialog.ShowDialog() == true)
|
if (saveFileDialog.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using SQLite.Net;
|
using System.IO;
|
||||||
using SQLite.Net.Platform.Generic;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace DebtMgr.ViewModel
|
namespace DebtMgr.ViewModel
|
||||||
{
|
{
|
||||||
@@ -418,6 +417,28 @@ namespace DebtMgr.ViewModel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region OpenDatabaseLocationMenuCommand Command
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Private member backing variable for <see cref="OpenDatabaseLocationMenuCommand" />
|
||||||
|
/// </summary>
|
||||||
|
private RelayCommand _openDatabaseLocationMenuCommand = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comment
|
||||||
|
/// </summary>
|
||||||
|
public RelayCommand OpenDatabaseLocationMenuCommand => _openDatabaseLocationMenuCommand ?? (_openDatabaseLocationMenuCommand = new RelayCommand(OpenDatabaseLocationMenuCommand_Execute));
|
||||||
|
|
||||||
|
private void OpenDatabaseLocationMenuCommand_Execute()
|
||||||
|
{
|
||||||
|
if (File.Exists(Properties.Settings.Default.Database))
|
||||||
|
{
|
||||||
|
Process.Start("explorer.exe", "/select, " + Properties.Settings.Default.Database);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// <summary> Initializes a new instance of the MainViewModel class. </summary>
|
/// <summary> Initializes a new instance of the MainViewModel class. </summary>
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user