mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
@@ -12,9 +12,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -45,6 +47,12 @@ namespace MeoAsstGui
|
||||
//LogItemViewModels.Insert(0, new LogItemViewModel(time + content, color, weight));
|
||||
}
|
||||
|
||||
public void AddLogWithUrl(string content,string url, string color = "Gray", string weight = "Regular")
|
||||
{
|
||||
LogItemViewModels.Add(new LogItemViewModel(content, color, weight));
|
||||
//LogItemViewModels.Insert(0, new LogItemViewModel(time + content, color, weight));
|
||||
}
|
||||
|
||||
private bool _idel = true;
|
||||
|
||||
public bool Idle
|
||||
@@ -119,8 +127,25 @@ namespace MeoAsstGui
|
||||
details_color = doc["details_color"].ToString();
|
||||
}
|
||||
AddLog(details, details_color);
|
||||
|
||||
{
|
||||
Url = "";
|
||||
var linkParser = new Regex(@"(?:https?://)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
foreach (Match m in linkParser.Matches(details))
|
||||
{
|
||||
Url = m.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AddLog(string.Format("\n共{0}名干员", ((JContainer)json["opers"]).Count), "black");
|
||||
foreach (JObject oper in json["opers"])
|
||||
{
|
||||
AddLog(string.Format("{0}, {1}技能", oper["name"], oper["skill"]), "black");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
@@ -200,5 +225,27 @@ namespace MeoAsstGui
|
||||
asstProxy.AsstStop();
|
||||
Idle = true;
|
||||
}
|
||||
|
||||
private string _url = "";
|
||||
|
||||
public string Url
|
||||
{
|
||||
get => _url;
|
||||
set => SetAndNotify(ref _url, value);
|
||||
}
|
||||
|
||||
public void Hyperlink_Click(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(url));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<CheckBox IsChecked="{Binding Form}" HorizontalAlignment="Center" IsHitTestVisible="{Binding Idle}" Content="自动编队" Height="50" Margin="10" />
|
||||
<Button Command="{s:Action Start}" IsEnabled="{Binding Idle}" Content="开始" Width="120" Height="50" Margin="10" />
|
||||
<Button Command="{s:Action Stop}" Content="停止" Width="120" Height="50" Margin="10" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center" Margin="10" >
|
||||
<Hyperlink Command="{s:Action Hyperlink_Click}" CommandParameter="{Binding Url}"><TextBlock Text="{Binding Url}"/></Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<ScrollViewer Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10"
|
||||
|
||||
Reference in New Issue
Block a user