Пример #1
0
        private async void barButtonItemDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                var version = gridViewVersions.GetRow(gridViewVersions.FocusedRowHandle) as SettingsVersion;

                if (version != null)
                {
                    if (application.Versions.Count == 1)
                    {
                        MessageBox.Show("This version can not be deleted as it is the only version", "Only version", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    if (MessageBox.Show(string.Format("Are you sure you want to delete version of application {0} and all the settings it contains?", version.Version, applicationName), "Delete Application Version and Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        await settingsManager.DeleteApplicationVersionAsync(applicationName, version.Version);
                        await LoadApplication();

                        Version = application.Versions.OrderByDescending(v => v.Created).First();
                    }
                }
            }
            catch (SettingsException ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void GridViewVersions_DoubleClick(object sender, EventArgs e)
        {
            SettingsVersion version = gridViewVersions.GetRow(gridViewVersions.FocusedRowHandle) as SettingsVersion;

            if (version != null)
            {
                Version = version;
                this.Close();
            }
        }
Пример #3
0
 private async void barButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         await settingsManager.CreateApplicationVersionAsync(applicationName, highVersion + 1);
         await LoadApplication();
         Version = application.Versions.OrderByDescending(v => v.Created).First();
     }
     catch (SettingsException ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #4
0
        private async void barButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                await settingsManager.CreateApplicationVersionAsync(applicationName, highVersion + 1);
                await LoadApplication();

                Version = application.Versions.OrderByDescending(v => v.Created).First();
            }
            catch (SettingsException ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #5
0
        private async void barButtonItemDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                var version = gridViewVersions.GetRow(gridViewVersions.FocusedRowHandle) as SettingsVersion;

                if (version != null)
                {
                    if (application.Versions.Count == 1)
                    {
                        MessageBox.Show("This version can not be deleted as it is the only version", "Only version", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    if (MessageBox.Show(string.Format("Are you sure you want to delete version of application {0} and all the settings it contains?", version.Version, applicationName), "Delete Application Version and Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        await settingsManager.DeleteApplicationVersionAsync(applicationName, version.Version);
                        await LoadApplication();

                        Version = application.Versions.OrderByDescending(v => v.Created).First();
                    }
                }
            }
            catch (SettingsException ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }