|
@@ -66,6 +66,12 @@ namespace Venus_MainPages.ViewModels
|
|
|
private JetChamber currentChamber;
|
|
|
private bool isInstalledEPD;
|
|
|
private bool m_IsFrozen;
|
|
|
+ private bool m_PMAIsInstalled;
|
|
|
+ private bool m_PMBIsInstalled;
|
|
|
+ private bool m_PMCIsInstalled;
|
|
|
+ private bool m_PMDIsInstalled;
|
|
|
+
|
|
|
+ private List<string> moduleList = new List<string> ();
|
|
|
#endregion
|
|
|
|
|
|
#region 属性
|
|
@@ -93,6 +99,26 @@ namespace Venus_MainPages.ViewModels
|
|
|
get { return m_IsFrozen; }
|
|
|
set { SetProperty(ref m_IsFrozen, value); }
|
|
|
}
|
|
|
+ public bool PMAIsInstalled
|
|
|
+ {
|
|
|
+ get { return m_PMAIsInstalled; }
|
|
|
+ set { SetProperty(ref m_PMAIsInstalled, value); }
|
|
|
+ }
|
|
|
+ public bool PMBIsInstalled
|
|
|
+ {
|
|
|
+ get { return m_PMBIsInstalled; }
|
|
|
+ set { SetProperty(ref m_PMBIsInstalled, value); }
|
|
|
+ }
|
|
|
+ public bool PMCIsInstalled
|
|
|
+ {
|
|
|
+ get { return m_PMCIsInstalled; }
|
|
|
+ set { SetProperty(ref m_PMCIsInstalled, value); }
|
|
|
+ }
|
|
|
+ public bool PMDIsInstalled
|
|
|
+ {
|
|
|
+ get { return m_PMDIsInstalled; }
|
|
|
+ set { SetProperty(ref m_PMDIsInstalled, value); }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 命令
|
|
@@ -109,6 +135,10 @@ namespace Venus_MainPages.ViewModels
|
|
|
public DelegateCommand SaveRecipeCommand =>
|
|
|
_SaveRecipeCommand ?? (_SaveRecipeCommand = new DelegateCommand(OnSaveRecipe));
|
|
|
|
|
|
+ private DelegateCommand<object> _SaveToRecipeCommand;
|
|
|
+ public DelegateCommand<object> SaveToRecipeCommand =>
|
|
|
+ _SaveToRecipeCommand ?? (_SaveToRecipeCommand = new DelegateCommand<object>(OnSaveToRecipe));
|
|
|
+
|
|
|
private DelegateCommand _AddStepCommand;
|
|
|
public DelegateCommand AddStepCommand =>
|
|
|
_AddStepCommand ?? (_AddStepCommand = new DelegateCommand(OnAddStep));
|
|
@@ -203,6 +233,87 @@ namespace Venus_MainPages.ViewModels
|
|
|
SaveRecipe(CurrentRecipeName, RecipeUnity.RecipeToString(CurrentRecipe));
|
|
|
LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
|
|
|
}
|
|
|
+ private void OnSaveToRecipe(object obj)
|
|
|
+ {
|
|
|
+ if (CurrentRecipe == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //JetChamber jetChamber = JetChamber.None;
|
|
|
+ string moduleName = "";
|
|
|
+ switch (obj.ToString())
|
|
|
+ {
|
|
|
+ case "0":
|
|
|
+ moduleName = "PMA";
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ moduleName = "PMB";
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ moduleName = "PMC";
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ moduleName = "PMD";
|
|
|
+ break;
|
|
|
+ case "4":
|
|
|
+ moduleName = "ALL";
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ if (moduleName == "")
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (moduleName == "ALL")
|
|
|
+ {
|
|
|
+ var newName = Interaction.InputBox(" ", $"Save Recipe To All", CurrentRecipeName, -1, -1);
|
|
|
+
|
|
|
+ foreach (var x in moduleList)
|
|
|
+ {
|
|
|
+ if (newName != "")
|
|
|
+ {
|
|
|
+ var targetChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{x}.ChamberType").ToString());
|
|
|
+ if (currentChamber != targetChamber)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ var newRecipe = CurrentRecipe;
|
|
|
+ newRecipe.Header.Name = newName;
|
|
|
+ newRecipe.Header.CreateTime = DateTime.Now.ToString();
|
|
|
+ var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", x, newName + ".rcp");
|
|
|
+ File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
|
|
|
+ UpdateRecipeFileList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //moduleList.ForEach(x =>
|
|
|
+ //{
|
|
|
+
|
|
|
+ //});
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var targetChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{moduleName}.ChamberType").ToString());
|
|
|
+ if (currentChamber != targetChamber)
|
|
|
+ {
|
|
|
+ WPFMessageBox.ShowError($"Recipe can not from {currentChamber.ToString()} copy to {targetChamber.ToString()}");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var newName = Interaction.InputBox(" ", $"Save Recipe To {moduleName}", CurrentRecipeName, -1, -1);
|
|
|
+ if (newName != "")
|
|
|
+ {
|
|
|
+
|
|
|
+ var newRecipe = CurrentRecipe;
|
|
|
+ newRecipe.Header.Name = newName;
|
|
|
+ newRecipe.Header.CreateTime = DateTime.Now.ToString();
|
|
|
+ var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", moduleName, newName + ".rcp");
|
|
|
+ File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
|
|
|
+ UpdateRecipeFileList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
private void OnLoaded(Object myrecipeView)
|
|
|
{
|
|
|
if (firstLoad == true)
|
|
@@ -237,9 +348,31 @@ namespace Venus_MainPages.ViewModels
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
|
|
|
+ if (allModules.Contains("PMA"))
|
|
|
+ {
|
|
|
+ PMAIsInstalled = true;
|
|
|
+ moduleList.Add("PMA");
|
|
|
+ }
|
|
|
+ if (allModules.Contains("PMB"))
|
|
|
+ {
|
|
|
+ PMBIsInstalled = true;
|
|
|
+ moduleList.Add("PMB");
|
|
|
+ }
|
|
|
+ if (allModules.Contains("PMC"))
|
|
|
+ {
|
|
|
+ PMCIsInstalled = true;
|
|
|
+ moduleList.Add("PMC");
|
|
|
+ }
|
|
|
+ if (allModules.Contains("PMD"))
|
|
|
+ {
|
|
|
+ PMDIsInstalled = true;
|
|
|
+ moduleList.Add("PMD");
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
+ UpdateRecipeFileList();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void TreeViewRcpList_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|