forked from ktvoelker/di
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented M+C support for file chooser with V support stubs
- Loading branch information
Showing
15 changed files
with
394 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,46 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 10.00 | ||
# Visual Studio 2008 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Di", "Di\Di.csproj", "{B7E42D49-B878-4E02-A30A-D4653BC3A847}" | ||
EndProject | ||
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "Packages", "Packages.mdproj", "{1210A0FA-12B2-4B45-9140-922A9B15686D}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B0169427-FDA2-485F-A1E2-280EE44D8F2D}" | ||
ProjectSection(SolutionItems) = preProject | ||
Controller.cs = Controller.cs | ||
ControllerEvents.cs = ControllerEvents.cs | ||
Main.cs = Main.cs | ||
Model.cs = Model.cs | ||
View.cs = View.cs | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ini", "Ini\Ini.csproj", "{8619C6C2-C719-4371-9F61-10A735FB8B99}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1210A0FA-12B2-4B45-9140-922A9B15686D}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{1210A0FA-12B2-4B45-9140-922A9B15686D}.Release|x86.ActiveCfg = Release|Any CPU | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Debug|x86.ActiveCfg = Debug|x86 | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Debug|x86.Build.0 = Debug|x86 | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Release|x86.ActiveCfg = Release|x86 | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Release|x86.Build.0 = Release|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Debug|x86.ActiveCfg = Debug|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Debug|x86.Build.0 = Debug|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Release|x86.ActiveCfg = Release|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
EndGlobalSection | ||
GlobalSection(MonoDevelopProperties) = preSolution | ||
StartupItem = Di\Di.csproj | ||
EndGlobalSection | ||
EndGlobal | ||
|
||
Microsoft Visual Studio Solution File, Format Version 10.00 | ||
# Visual Studio 2008 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Di", "Di\Di.csproj", "{B7E42D49-B878-4E02-A30A-D4653BC3A847}" | ||
EndProject | ||
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "Packages", "Packages.mdproj", "{1210A0FA-12B2-4B45-9140-922A9B15686D}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B0169427-FDA2-485F-A1E2-280EE44D8F2D}" | ||
ProjectSection(SolutionItems) = preProject | ||
Controller.cs = Controller.cs | ||
ControllerEvents.cs = ControllerEvents.cs | ||
Main.cs = Main.cs | ||
Model.cs = Model.cs | ||
View.cs = View.cs | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ini", "Ini\Ini.csproj", "{8619C6C2-C719-4371-9F61-10A735FB8B99}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9AD86991-1B57-43B2-90EA-6243998DA089}" | ||
ProjectSection(SolutionItems) = preProject | ||
Di\Model\Language.cs = Di\Model\Language.cs | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1210A0FA-12B2-4B45-9140-922A9B15686D}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{1210A0FA-12B2-4B45-9140-922A9B15686D}.Release|x86.ActiveCfg = Release|Any CPU | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Debug|x86.ActiveCfg = Debug|x86 | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Debug|x86.Build.0 = Debug|x86 | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Release|x86.ActiveCfg = Release|x86 | ||
{8619C6C2-C719-4371-9F61-10A735FB8B99}.Release|x86.Build.0 = Release|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Debug|x86.ActiveCfg = Debug|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Debug|x86.Build.0 = Debug|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Release|x86.ActiveCfg = Release|x86 | ||
{B7E42D49-B878-4E02-A30A-D4653BC3A847}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
EndGlobalSection | ||
GlobalSection(MonoDevelopProperties) = preSolution | ||
StartupItem = Di\Di.csproj | ||
EndGlobalSection | ||
EndGlobal |
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,65 @@ | ||
// | ||
// FileChooser.cs | ||
// | ||
// Author: | ||
// Karl Voelker <[email protected]> | ||
// | ||
// Copyright (c) 2011 Karl Voelker | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
using System; | ||
using System.Collections.Generic; | ||
namespace Di.Controller | ||
{ | ||
public class FileChooser | ||
{ | ||
private Di.Model.Project project; | ||
|
||
private Action<Di.Model.ProjectFile> handler; | ||
|
||
private Di.Model.FileQuery query; | ||
|
||
public string Query | ||
{ | ||
set | ||
{ | ||
query = new Di.Model.FileQuery(value); | ||
Files.Clear(); | ||
Update(); | ||
} | ||
} | ||
|
||
public BindList<Di.Model.ProjectFile> Files; | ||
|
||
public FileChooser(Di.Model.Project _project, Action<Di.Model.ProjectFile> _handler) | ||
{ | ||
project = _project; | ||
handler = _handler; | ||
query = new Di.Model.FileQuery(""); | ||
Files = new BindList<Di.Model.ProjectFile>(); | ||
Update(); | ||
} | ||
|
||
public void Choose(Di.Model.ProjectFile file) | ||
{ | ||
handler(file); | ||
} | ||
|
||
private void Update() | ||
{ | ||
query.Evaluate(project.Files).ForEach(f => Files.Add(f)); | ||
} | ||
} | ||
} | ||
|
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
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,41 @@ | ||
// | ||
// FileQuery.cs | ||
// | ||
// Author: | ||
// Karl Voelker <[email protected]> | ||
// | ||
// Copyright (c) 2011 Karl Voelker | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
namespace Di.Model | ||
{ | ||
public class FileQuery | ||
{ | ||
private string query; | ||
|
||
public FileQuery(string _query) | ||
{ | ||
query = _query; | ||
} | ||
|
||
public IQueryable<ProjectFile> Evaluate(IEnumerable<ProjectFile> files) | ||
{ | ||
return files.AsQueryable().Where(f => f.File.Name == query); | ||
} | ||
} | ||
} | ||
|
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,33 @@ | ||
// | ||
// Language.cs | ||
// | ||
// Author: | ||
// Karl Voelker <[email protected]> | ||
// | ||
// Copyright (c) 2011 Karl Voelker | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
using System; | ||
namespace Di.Model.Language | ||
{ | ||
public abstract class Base | ||
{ | ||
public string Name { get; protected set; } | ||
|
||
public Base() | ||
{ | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.