-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathModsControl.xaml.cs
More file actions
81 lines (73 loc) · 2.37 KB
/
ModsControl.xaml.cs
File metadata and controls
81 lines (73 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sandbox.Engine.Networking;
using VRage.Game;
namespace Torch.Server
{
/// <summary>
/// Interaction logic for ModsControl.xaml
/// </summary>
public partial class ModsControl : UserControl
{
public ModsControl()
{
InitializeComponent();
}
private void addBtn_Click(object sender, RoutedEventArgs e)
{
ulong[] mods;
if (!string.IsNullOrEmpty(ModIdBox.Text))
{
mods = new ulong[1];
ulong.TryParse(ModIdBox.Text, out mods[0]);
}
else
{
var dialog = new AddModsDialog();
dialog.ShowDialog();
mods = dialog.Result;
}
//foreach (var id in mods)
//{
// var details = SteamHelper.GetItemDetails(id);
// if (details.FileType != WorkshopFileType.Community)
// continue;
// var item = SteamHelper.GetModItem(details);
// var desc = details.Description.Length < 500 ? details.Description : details.Description.Substring(0, 500);
// ModList.Items.Add(new ModViewModel(item, desc));
//}
}
private void modList_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var box = (ListView)sender;
if (box.SelectedItem == null)
return;
var id = ((ModViewModel)box.SelectedItem).PublishedFileId;
Process.Start($"http://steamcommunity.com/sharedfiles/filedetails/?id={id}");
}
private void remBtn_Click(object sender, RoutedEventArgs e)
{
var box = (ListView)sender;
if (box.SelectedItems == null || box.SelectedItems.Count == 0)
return;
foreach (var item in box.SelectedItems)
{
box.Items.Remove(item);
}
}
}
}