Exemplo n.º 1
0
        internal void CloseHost(CancelEventArgs e)
        {
            try
            {
                if (Host != null)
                {
                    Host.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Can't close host. Message - {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (fileProcess.IsChange)
            {
                DialogResult result = MessageBox.Show("Save this datas?", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                switch (result)
                {
                case DialogResult.Yes:
                {
                    fileProcess.SaveDataFile(Saves.ToList());
                    break;
                }

                case DialogResult.Cancel:
                {
                    e.Cancel = true;
                    break;
                }

                default: break;
                }
            }
        }