feat: restore two-step legacy launcher workflow
This commit is contained in:
@@ -1 +1 @@
|
||||
<Window x:Class="Launcher.Next.App.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Launcher Next" Height="560" Width="780"><Grid Margin="20"><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><TextBlock FontSize="22" FontWeight="SemiBold" Text="Launcher Next — Plant 3D 2026"/><Grid Grid.Row="1" Margin="0,18,0,10"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><GroupBox Header="Autodesk"><StackPanel Margin="8"><TextBlock x:Name="AutodeskStatus"/><TextBlock x:Name="ExecutableStatus" TextWrapping="Wrap"/><Button Margin="0,8,0,0" Content="Refresh" Click="Refresh_Click"/></StackPanel></GroupBox><GroupBox Grid.Column="1" Header="Configuration" Margin="12,0,0,0"><StackPanel Margin="8"><TextBlock x:Name="ConfigurationStatus" Text="Configuration not selected"/><Button Margin="0,8,0,0" Content="Open legacy Settings.xml" Click="OpenSettings_Click"/></StackPanel></GroupBox></Grid><Grid Grid.Row="2"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><GroupBox Header="Available configurations"><ListBox x:Name="Patterns" Margin="8" DisplayMemberPath="Name" SelectionChanged="Patterns_SelectionChanged"/></GroupBox><GroupBox Grid.Column="1" Header="Selected configuration" Margin="12,0,0,0"><StackPanel Margin="8"><TextBlock x:Name="PatternDetails" TextWrapping="Wrap"/><TextBlock Margin="0,12,0,0" Text="Packages" FontWeight="SemiBold"/><TextBlock x:Name="PackageStatus" Text="Package preparation required" TextWrapping="Wrap"/></StackPanel></GroupBox></Grid><StackPanel Grid.Row="3" Margin="0,14,0,0"><WrapPanel><Button x:Name="PrepareButton" Content="Prepare / Install / Update" IsEnabled="False" Margin="0,0,8,0" Click="Prepare_Click"/><Button x:Name="LaunchButton" Content="Launch Plant 3D" IsEnabled="False" Click="Launch_Click"/><Button Content="Diagnostics" Margin="8,0,0,0" Click="Diagnostics_Click"/></WrapPanel><TextBlock x:Name="Status" Margin="0,10,0,0" TextWrapping="Wrap"/></StackPanel></Grid></Window>
|
||||
<Window x:Class="Launcher.Next.App.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Launcher Next" Height="620" Width="840"><Grid Margin="20"><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><TextBlock FontSize="22" FontWeight="SemiBold" Text="Launcher Next"/><GroupBox Grid.Row="1" Header="Выберите ПО" Margin="0,14,0,0"><StackPanel Margin="8"><ListBox x:Name="Products" DisplayMemberPath="Name" SelectionChanged="Products_SelectionChanged" Height="78"/><TextBlock x:Name="ProductStatus" Margin="0,7,0,0" TextWrapping="Wrap"/></StackPanel></GroupBox><GroupBox Grid.Row="2" Header="Проект и режим загрузки" Margin="0,10,0,0"><Grid Margin="8"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><StackPanel><TextBlock Text="Путь к проекту:"/><TextBlock x:Name="ProjectPath" Text="Выберите программное обеспечение" TextWrapping="Wrap"/><StackPanel Orientation="Horizontal" Margin="0,10,0,0"><RadioButton x:Name="AutomaticMode" Content="Автоматически" IsChecked="True" Checked="LoadMode_Changed"/><RadioButton x:Name="ListMode" Content="По списку" Margin="22,0,0,0" Checked="LoadMode_Changed"/></StackPanel></StackPanel><Button Grid.Column="1" x:Name="SelectProjectButton" Content="Выбрать проект" IsEnabled="False" VerticalAlignment="Center" Margin="16,0,0,0" Click="SelectProject_Click"/></Grid></GroupBox><GroupBox Grid.Row="3" Header="Список плагинов" Margin="0,10,0,0"><StackPanel Margin="8"><TextBlock x:Name="PluginStatus" Text="Список будет определён после выбора проекта." TextWrapping="Wrap"/><ListBox x:Name="Plugins" SelectionMode="Multiple" DisplayMemberPath="Id" Margin="0,8,0,0" Height="110" IsEnabled="False"/></StackPanel></GroupBox><StackPanel Grid.Row="4" Margin="0,14,0,0"><WrapPanel><Button x:Name="StartButton" Content="Выбрать плагины и приступить к работе" IsEnabled="False" Click="Start_Click"/><Button Content="Справка" Margin="8,0,0,0" Click="Help_Click"/><Button Content="Диагностика" Margin="8,0,0,0" Click="Diagnostics_Click"/></WrapPanel><TextBlock x:Name="Status" Margin="0,10,0,0" TextWrapping="Wrap"/><TextBlock x:Name="Version" Margin="0,5,0,0"/></StackPanel></Grid></Window>
|
||||
|
||||
@@ -1,47 +1,56 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Launcher.Next.Application;
|
||||
using Launcher.Next.Autodesk;
|
||||
|
||||
namespace Launcher.Next.App;
|
||||
|
||||
public partial class MainWindow : System.Windows.Window
|
||||
{
|
||||
private readonly LegacyConfigurationAdapter adapter=new();
|
||||
private sealed record LauncherProduct(string Id,string Name,string? Executable,string Diagnostic);
|
||||
private readonly LocalParityLaunchProfile? localProfile;
|
||||
private readonly LocalParityLaunchService localService=new();
|
||||
private LocalParityPrepared? prepared;
|
||||
public MainWindow() { InitializeComponent(); RefreshDiscovery(); Status.Text="Ready: choose a legacy Settings.xml to inspect approved configurations."; }
|
||||
internal MainWindow(LocalParityLaunchProfile profile) { localProfile=profile; InitializeComponent(); RefreshDiscovery(); LoadLocalProfile(profile); }
|
||||
private void RefreshDiscovery()
|
||||
private readonly LegacyConfigurationAdapter adapter=new();
|
||||
private LauncherProduct? selected;
|
||||
private string? projectPath;
|
||||
public MainWindow() { InitializeComponent(); Initialize(); }
|
||||
internal MainWindow(LocalParityLaunchProfile profile) { localProfile=profile; InitializeComponent(); Initialize(); }
|
||||
private void Initialize()
|
||||
{
|
||||
var product=new PlantProductDiscovery(new WindowsRegistryReader()).DiscoverPlant3D(2026);
|
||||
AutodeskStatus.Text=product is null?"Autodesk Plant 3D 2026: Not found":"Autodesk Plant 3D 2026: Found";
|
||||
ExecutableStatus.Text=product is null?"Discovery diagnostic: ACAD-9117 Plant 3D registry entry or executable unavailable.":$"Executable: {product.ExecutablePath}";
|
||||
var plant=new PlantProductDiscovery(new WindowsRegistryReader()).DiscoverPlant3D(2026);
|
||||
var navisworks=Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),"Autodesk","Navisworks Manage 2026","Roamer.exe");
|
||||
Products.ItemsSource=new[]{new LauncherProduct("navisworks","Navisworks Manage 2026",File.Exists(navisworks)?navisworks:null,File.Exists(navisworks)?"Найден":"Navisworks Manage 2026 не найден"),new LauncherProduct("pnid","Plant P&ID 2026",plant?.ExecutablePath,plant is null?"Plant P&ID 2026 не найден":"Используется установленный Plant 3D 2026 runtime"),new LauncherProduct("plant3d","Plant 3D 2026",plant?.ExecutablePath,plant is null?"Plant 3D 2026 не найден":"Найден")};
|
||||
Version.Text="Версия: "+typeof(MainWindow).Assembly.GetName().Version;
|
||||
Status.Text="Выберите программное обеспечение.";
|
||||
if(localProfile is not null) { Products.SelectedIndex=2; Status.Text="Выберите controlled non-production папку проекта."; }
|
||||
}
|
||||
private void Refresh_Click(object sender,System.Windows.RoutedEventArgs e)=>RefreshDiscovery();
|
||||
private void OpenSettings_Click(object sender,System.Windows.RoutedEventArgs e)
|
||||
private void Products_SelectionChanged(object sender,System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{ selected=Products.SelectedItem as LauncherProduct; projectPath=null; ProjectPath.Text=selected is null?"Выберите программное обеспечение":"Папка проекта не выбрана"; SelectProjectButton.IsEnabled=selected?.Executable is not null; StartButton.IsEnabled=false; Plugins.ItemsSource=null; Plugins.IsEnabled=false; ProductStatus.Text=selected?.Diagnostic??""; Status.Text=selected?.Executable is null?selected?.Diagnostic??"Выберите программное обеспечение":"Выберите папку проекта."; }
|
||||
private void SelectProject_Click(object sender,System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
var dialog=new Microsoft.Win32.OpenFileDialog { Filter="Settings.xml|Settings.xml|XML files|*.xml" };
|
||||
if(dialog.ShowDialog()!=true)return;
|
||||
try { var settings=adapter.ParseSettings(System.IO.File.ReadAllText(dialog.FileName)); Patterns.ItemsSource=settings.Patterns; ConfigurationStatus.Text=$"Loaded {settings.Patterns.Count} configuration(s) from {System.IO.Path.GetFileName(dialog.FileName)}"; Status.Text="Select a configuration. Exact package preparation remains blocked until an approved compatibility overlay and local verified catalog are supplied."; }
|
||||
catch(System.Exception ex) { ConfigurationStatus.Text="Configuration invalid";Status.Text=$"Blocked: {ex.Message}";Patterns.ItemsSource=null; }
|
||||
if(selected is null)return; var dialog=new Microsoft.Win32.OpenFolderDialog { Title="Выберите папку проекта" }; if(dialog.ShowDialog()!=true)return;
|
||||
var path=Path.GetFullPath(dialog.FolderName); if(!Directory.Exists(path)){Status.Text="Выбранная папка недоступна.";return;} if(selected.Id is "plant3d" or "pnid" && !File.Exists(Path.Combine(path,"Project.xml"))){Status.Text="Выбранная папка не является проектом Plant 3D.";return;}
|
||||
projectPath=path; ProjectPath.Text=path; ResolvePlugins();
|
||||
}
|
||||
private void Patterns_SelectionChanged(object sender,System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{ if(Patterns.SelectedItem is not LegacyProductPattern pattern)return;PatternDetails.Text=$"Filter: {pattern.Filter}\nRoster: {pattern.Roster}\nLegacy plugins: {pattern.Plugins.Count}";PackageStatus.Text="Exact package requirements are derived only after approved overlay + ordered download_list.xml join.";Status.Text="Configuration selected; provide approved local compatibility inputs to prepare packages."; }
|
||||
private void Diagnostics_Click(object sender,System.Windows.RoutedEventArgs e)=>System.Windows.MessageBox.Show($"{AutodeskStatus.Text}\n{ConfigurationStatus.Text}\n{Status.Text}","Launcher Next diagnostics");
|
||||
private void LoadLocalProfile(LocalParityLaunchProfile profile)
|
||||
private void LoadMode_Changed(object sender,System.Windows.RoutedEventArgs e) { if(projectPath is not null)ResolvePlugins(); }
|
||||
private void ResolvePlugins()
|
||||
{
|
||||
try { var settings=adapter.ParseSettings(System.IO.File.ReadAllText(profile.SettingsPath)); Patterns.ItemsSource=settings.Patterns; Patterns.SelectedItem=settings.Patterns.Single(x=>x.Name==profile.PatternName); ConfigurationStatus.Text="Controlled Local PXP-OA"; PrepareButton.IsEnabled=true; LaunchButton.IsEnabled=false; Status.Text="Ready: local verified package preparation is available; Launch is disabled until activation succeeds."; }
|
||||
catch(Exception ex) { Status.Text="Blocked: "+ex.Message; }
|
||||
if(selected is null||projectPath is null)return;
|
||||
if(localProfile is not null && selected.Id=="plant3d")
|
||||
{
|
||||
var settings=adapter.ParseSettings(File.ReadAllText(localProfile.SettingsPath)); var pattern=settings.Patterns.Single(x=>x.Name==localProfile.PatternName); Plugins.ItemsSource=pattern.Plugins; Plugins.IsEnabled=ListMode.IsChecked==true; foreach(var item in Plugins.Items)Plugins.SelectedItems.Add(item); PluginStatus.Text=AutomaticMode.IsChecked==true?"Плагины определены автоматически для выбранного проекта.":"Выберите допустимый список плагинов."; StartButton.IsEnabled=true; Status.Text="Готово к запуску."; return;
|
||||
}
|
||||
PluginStatus.Text="Для выбранного продукта нет approved local mapping пакетов."; Plugins.ItemsSource=null; Plugins.IsEnabled=false; StartButton.IsEnabled=false; Status.Text="Источник пакета недоступен для выбранного продукта.";
|
||||
}
|
||||
private async void Prepare_Click(object sender,System.Windows.RoutedEventArgs e)
|
||||
private async void Start_Click(object sender,System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if(localProfile is null) { Status.Text="Blocked: choose an explicit controlled local configuration."; return; }
|
||||
try { PrepareButton.IsEnabled=false; Status.Text="Preparing verified local package…"; prepared=await localService.PrepareAsync(localProfile,CancellationToken.None); PackageStatus.Text=$"Package: {prepared.Package.PackageId} {prepared.Package.Version}\nState: Active\nValidation: Passed"; LaunchButton.IsEnabled=true; Status.Text="Package active and verified. Launch Plant 3D is enabled."; }
|
||||
catch(Exception ex) { Status.Text="Prepare blocked: "+ex.Message; PrepareButton.IsEnabled=true; }
|
||||
}
|
||||
private async void Launch_Click(object sender,System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if(prepared is null) { Status.Text="Launch blocked: package is not active."; return; }
|
||||
try { LaunchButton.IsEnabled=false; Status.Text="Launching interactive Plant 3D 2026…"; var result=await localService.LaunchAsync(prepared,CancellationToken.None); Status.Text=result.TerminalState=="Succeeded"?$"Plant 3D started (PID {result.ProcessId}); PXP-OA load confirmed.":$"Launch blocked; evidence written. PID {result.ProcessId}."; LaunchButton.IsEnabled=true; }
|
||||
catch(Exception ex) { Status.Text="Launch failed: "+ex.Message; LaunchButton.IsEnabled=true; }
|
||||
if(localProfile is null||selected?.Id!="plant3d"||projectPath is null){Status.Text="Не удалось определить список плагинов.";return;}
|
||||
try { StartButton.IsEnabled=false; Status.Text="Подготовка плагинов…"; var prepared=await localService.PrepareAsync(localProfile,CancellationToken.None); Status.Text="Запуск Autodesk…"; var result=await localService.LaunchAsync(prepared,CancellationToken.None); Status.Text=result.TerminalState=="Succeeded"?$"Autodesk запущен (PID {result.ProcessId}).":"Не удалось подтвердить загрузку пакета; диагностика сохранена."; StartButton.IsEnabled=true; }
|
||||
catch(Exception ex){Status.Text="Ошибка: "+UserMessage(ex.Message);StartButton.IsEnabled=true;}
|
||||
}
|
||||
private static string UserMessage(string code)=>code.Contains("NOT_FOUND",StringComparison.Ordinal)?"Не найден Plant 3D 2026":code.Contains("MANIFEST",StringComparison.Ordinal)?"Пакет повреждён":code.Contains("ACTIVATION",StringComparison.Ordinal)?"Не удалось активировать пакет":"Не удалось запустить Autodesk";
|
||||
private void Help_Click(object sender,System.Windows.RoutedEventArgs e)=>System.Windows.MessageBox.Show("Выберите ПО, затем папку проекта. В автоматическом режиме Launcher сам подготовит допустимые пакеты и запустит Autodesk.","Справка");
|
||||
private void Diagnostics_Click(object sender,System.Windows.RoutedEventArgs e)=>System.Windows.MessageBox.Show($"{selected?.Diagnostic}\n{ProjectPath.Text}\n{Status.Text}","Диагностика Launcher Next");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user