-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-7) First pass at creating export function
- Using a simple PersistenceService, i.e. Open/Save Dialog - Provide option to export the current list of installed packages to a packages.config file
- Loading branch information
Showing
7 changed files
with
105 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright company="Chocolatey" file="IPersistenceService.cs"> | ||
// Copyright 2014 - Present Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ChocolateyGui.Services | ||
{ | ||
using System.IO; | ||
|
||
public interface IPersistenceService | ||
{ | ||
Stream OpenFile(string defaultExtension, string filter); | ||
|
||
Stream SaveFile(string defaultExtension, string filter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright company="Chocolatey" file="PersistenceService.cs"> | ||
// Copyright 2014 - Present Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ChocolateyGui.Services | ||
{ | ||
using System.IO; | ||
using Microsoft.Win32; | ||
|
||
public class PersistenceService : IPersistenceService | ||
{ | ||
public Stream OpenFile(string defaultExtension, string filter) | ||
{ | ||
var fd = new OpenFileDialog { DefaultExt = defaultExtension, Filter = filter }; | ||
|
||
var result = fd.ShowDialog(); | ||
|
||
return result != null && result.Value ? fd.OpenFile() : null; | ||
} | ||
|
||
public Stream SaveFile(string defaultExtension, string filter) | ||
{ | ||
var fd = new SaveFileDialog { DefaultExt = defaultExtension, Filter = filter }; | ||
|
||
var result = fd.ShowDialog(); | ||
|
||
return result != null && result.Value ? fd.OpenFile() : null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters