fix addons

This commit is contained in:
Alex Z 2020-02-03 13:08:15 +03:00
parent badbb43b3b
commit 6a0544df5f
5 changed files with 53 additions and 13 deletions

View File

@ -26,5 +26,7 @@ namespace UniversalValveToolbox.Model.Dto {
get => args;
set => UpdateField(value, ref args);
}
public override string ToString() => name;
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversalValveToolbox.Base;
using UniversalValveToolbox.Model.Dto;
namespace UniversalValveToolbox.Model.ViewModel {
class FormProjectViewModel: DtoModel {
private ProjectDtoModel selectProject;
public ProjectDtoModel SelectProject {
get => selectProject;
set => UpdateField(value, ref selectProject);
}
}
}

View File

@ -161,7 +161,8 @@ namespace UniversalValveToolbox {
removeItem.ForEach(item => listView.Items.Remove(item));
if (pathSelectedEngine != null) {
var pairPathIconTools = SelectedEngine.Tools.Select(tool => {
var pairPathIconTools = SelectedEngine.Tools
.Select(tool => {
var keyByPath = Path.Combine(pathSelectedEngine, tool.Bin);
var icon = Icon.ExtractAssociatedIcon(Path.Combine(pathSelectedEngine, tool.Bin));
@ -204,10 +205,16 @@ namespace UniversalValveToolbox {
removeItem.ForEach(item => listView.Items.Remove(item));
if (pathSelectedEngine != null) {
var pairPathIconTools = addonsSelectedEngine.Select(addons => {
var keyByPath = Path.Combine(pathSelectedEngine, addons.Bin);
var icon = Icon.ExtractAssociatedIcon(Path.Combine(pathSelectedEngine, addons.Bin));
var pairPathIconTools = addonsSelectedEngine
.Where(addon => {
var path = addon.Bin;
return File.Exists(path);
})
.Select(addons => {
var keyByPath = addons.Bin;
var icon = Icon.ExtractAssociatedIcon(keyByPath);
return new Pair(keyByPath, icon);
});
@ -216,7 +223,6 @@ namespace UniversalValveToolbox {
listView.SmallImageList.Images.Add((string)pair.First, (Icon)pair.Second);
listView.LargeImageList.Images.Add((string)pair.First, (Icon)pair.Second);
}
}
var itemsAddons = addonsSelectedEngine.Select(addons => {
string keyByPath = null;

View File

@ -1,10 +1,23 @@
using System;
using kasthack.binding.wf;
using System;
using System.Windows.Forms;
using UniversalValveToolbox.Model.Provider;
using UniversalValveToolbox.Model.ViewModel;
namespace UniversalValveToolbox {
public partial class FormProfiles : Form {
private DataProvider dataProvider = new DataProvider();
private FormProjectViewModel model = new FormProjectViewModel();
public FormProfiles() {
InitializeComponent();
comboBox_Mod.Items.Clear();
comboBox_Mod.Items.AddRange(dataProvider.Projects);
//textBox1.Text = "1";
//textBox1.Bind(a => a.Name, model, a => a.SelectProject.Name);
}
private void FormEditProfile_Load(object sender, EventArgs e) {

View File

@ -61,7 +61,8 @@
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Model\VIewModel\SteamDataViewModel.cs" />
<Compile Include="Model\ViewModel\FormProjectViewModel.cs" />
<Compile Include="Model\ViewModel\SteamDataViewModel.cs" />
<Compile Include="Properties\translations\LangDict.Designer.cs">
<DependentUpon>LangDict.resx</DependentUpon>
<AutoGen>True</AutoGen>
@ -145,7 +146,7 @@
<Compile Include="Utils\JsonFileUtil.cs" />
<Compile Include="Utils\LanguageManager.cs" />
<Compile Include="Model\Dto\ToolDtoModel.cs" />
<Compile Include="Model\VIewModel\SettingsViewModel.cs" />
<Compile Include="Model\ViewModel\SettingsViewModel.cs" />
<Compile Include="Model\Dto\SettingsDtoModel.cs" />
<Compile Include="Model\Provider\LanguageProvider.cs" />
<Compile Include="Utils\SteamManager.cs" />