Ejemplo n.º 1
0
        private void renameButton_Click(object sender, EventArgs e)
        {
            var localDemo = localRepositoryView.SelectedDemo as LocalDemo;

            if (localDemo == null)
            {
                return;
            }

            var form = new FrmRename("demo", localDemo.Name);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                localDemo.Name = form.Value;

                localRepositoryView.ReloadLabels();
                localRepositoryView.Focus();
            }
        }
Ejemplo n.º 2
0
        private async void uploadButton_Click(object sender, EventArgs e)
        {
            var demo = localRepositoryView.SelectedDemo as LocalDemo;

            if (demo == null)
            {
                return;
            }

            // Demo still has a default name - require it to be renamed.
            if (demo.Name.StartsWith("demo") && demo.Name.Skip(4).All(c => '0' <= c && c <= '9'))
            {
                if (
                    MessageBox.Show(this, "You are trying to upload a demo which has a default demo name.\n" +
                                    "Before you can upload this demo, you'll need to rename it.", "Upload demo",
                                    MessageBoxButtons.OKCancel,
                                    MessageBoxIcon.Warning) == DialogResult.Cancel)
                {
                    return;
                }

                var form = new FrmRename("demo", demo.Name);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    demo.Name = form.Value;

                    localRepositoryView.ReloadLabels();
                    localRepositoryView.Focus();
                }
                else
                {
                    return;
                }
            }

            await Upload(demo);
        }