Пример #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            RecipeData data = new RecipeData();

            data.name = curContent[(int)DataIndex.Name];
            (new FileIO()).FileDelete(data);

            RefreshList();
        }
Пример #2
0
        public UpdateRecipe(List <string> curRecipe, UI master, params Panel[] panels)
        {
            recipeData     = new RecipeData();
            this.curRecipe = curRecipe;
            this.panels    = panels;

            mainPanel    = new CreateRecipe(panels[1], "주재료");
            subPanel     = new CreateRecipe(panels[2], "소스");
            contentPanel = new CreateRecipe(master, "레시피", panels[3], panels[0], panels[1], panels[2]);

            InitData();
            SetTitleText();
            SetFoodText();
        }
Пример #3
0
        public bool SaveFile(RecipeData data)
        {
            string path = curDir + @"\recipe\" + data.name + ".csv";

            FileStream   fs;
            StreamWriter sw;

            try
            {
                fs = new FileStream(path, FileMode.Create);
                sw = new StreamWriter(fs, Encoding.Default);

                sw.WriteLine(data.category);
                sw.WriteLine(data.level);
                sw.WriteLine(data.time);

                string foods = "";
                foreach (string item in data.mainFood)
                {
                    foods += item + ",";
                }
                sw.WriteLine(foods);

                string sub = "\"";
                foreach (string item in data.subFood)
                {
                    sub += item + ",";
                }
                sub += "\"";
                sw.WriteLine(sub);

                foreach (string item in data.content)
                {
                    sw.WriteLine(item);
                }

                sw.Close();
                fs.Close();

                MessageBox.Show("저장 했습니다.");
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show("저장에 실패했습니다.");
                return(true);
            }
        }
Пример #4
0
        public bool FileDelete(RecipeData data)
        {
            string path = curDir + @"\recipe\" + data.name + ".csv";

            try
            {
                File.Delete(path);

                MessageBox.Show("삭제를 완료했습니다.");

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show("삭제 실패");

                return(false);
            }
        }
        public CreateRecipe(UI master, string name, Panel curPanel, params Panel[] otherPanel)
        {
            this.master = master;
            recipeData  = new RecipeData();
            panels      = new List <Panel>();

            this.curPanel = curPanel;

            foreach (var panel in otherPanel)
            {
                panels.Add(panel);
            }
            panels.Add(curPanel);

            boxCount = 0;

            Init(name);

            SaveRecipe();
        }