d23004
2023-05-24 fa87a558389d9d425f70afa1c8de54c69875ef2c
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using SA_LTT;
using SA_LTT.Info.RecipeInfo;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace SA_LTT_UI.Viewer
{
    public partial class FoupRecipeSelectViewer : Form
    {
        MainFrame _mainFrame;
 
        private FoupRecipe currentFoupRecipe;
 
        public FoupRecipe CurrentFoupRecipe
        {
            get
            {
                return currentFoupRecipe;
            }
 
            set
            {
                currentFoupRecipe = value;
            }
        }
 
        public FoupRecipeSelectViewer(MainFrame mainFrame)
        {
            InitializeComponent();
 
            _mainFrame = mainFrame;
            RefreshFoupRecipes();
        }
 
        public void RefreshFoupRecipes()
        {
            _mainFrame.equipment.foupRecipeManager.RefreshRecipes();
 
            cbb_FoupRecipe.Items.Clear();
 
            FoupRecipe[] recipes = _mainFrame.equipment.foupRecipeManager.GetRecipeList();
 
            foreach (FoupRecipe recipe in recipes)
            {
                cbb_FoupRecipe.Items.Add(recipe.Name);
            }
 
            if(cbb_FoupRecipe.Items.Count > 0)
            {
                cbb_FoupRecipe.SelectedIndex = 0;
            }
        }
 
        public void RefreshFoupRecipeData()
        {
            lv_Recipes.Items.Clear();
 
            if (CurrentFoupRecipe != null)
            {
                FoupRecipe originalRecipe = _mainFrame.equipment.foupRecipeManager.GetRecipe(CurrentFoupRecipe.Name);
 
                for (int i = 24; i >= 0; i--)
                {
                    ListViewItem lvi = new ListViewItem($"{i + 1}");
                    
                    if (originalRecipe.RecipeNames[i] == null)
                    {
                        lvi.SubItems.Add("Empty");
                    }
                    else
                    {
                        lvi.SubItems.Add(originalRecipe.RecipeNames[i]);
                    }
 
                    lv_Recipes.Items.Add(lvi);
                }
            }
        }
 
        private void cbb_FoupRecipe_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurrentFoupRecipe = _mainFrame.equipment.foupRecipeManager.Recipes[cbb_FoupRecipe.Text];
            RefreshFoupRecipeData();
        }
 
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            EquipmentLogManager.Instance.WriteButtonLog($"{this.Name} : {((Control)sender).Text}");
            this.Close();
        }
 
        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}