common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessLogOff.cs
2026-04-23 17:50:07 +02:00

63 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Controls;
using Logic.ProductionToProductMapper.Cordonel;
using ProductionUiCordonelLegacy.ProductionProcesses.Enum;
using ProductionUiCordonelLegacy.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonelLegacy.ProductionProcesses.Actions
{
public class ProductionProcessLogOff : BaseProductionProcess
{
private UcPlain UserControl;
public ProductionProcessLogOff()
{
name = "Log Off";
currentProcessState = ProductionProcessState.Waiting;
}
public override void InitUserControl()
{
UserControl = new UcPlain();
UserControl.lblHl.Content = name;
UserControl.lblText.Content = "Abmelden um Einstellungen zu übernehmen";
}
public override UserControl GetControl()
{
if (UserControl == null)
{
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
public override void ProcessDone()
{
//clear
}
public override void StartProcess()
{
var apps = new List<CordonelAppVersion>();
foreach (var item in Meter.MeterAppListVersion)
{
apps.Add(new CordonelAppVersion(item.AppId, item.StrVersion, item.AppId != 15));
}
apps.Add(new CordonelAppVersion(-1, Meter.StrCoreRevision, false));
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetCordonelProgress?PcbId={Meter.PcbId}&ProgressName=Shipping&version={Assembly.GetExecutingAssembly().GetName().Version}";
LocalWebRequest.PostRequestAsync(url, json: apps);
Meter.PushProgress("Shipping", Assembly.GetExecutingAssembly().GetName().Version.ToString());
Meter.Logout();
currentProcessState = ProductionProcessState.Done;
}
}
}