private async void DoDisplayProgramInfo(IProgram program)
        {
            if (program != null)
            {
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    ProgramInformation form = new ProgramInformation(this, _context)
                    {
                        MyProgram = program,
                        MyStreamingEndpoints = dataGridViewStreamingEndpointsV.DisplayedStreamingEndpoints // we pass this information if user open asset info from the program info dialog box
                    };

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        program.ArchiveWindowLength = form.archiveWindowLength;
                        program.Description = form.ProgramDescription;
                        await Task.Run(() => ProgramExecuteAsync(program.UpdateAsync, program, "updated"));
                    }
                }
                finally
                {
                    this.Cursor = Cursors.Arrow;
                }
            }
        }
Esempio n. 2
0
        private async void DoDisplayProgramInfo(List<IProgram> programs)
        {
            bool multiselection = programs.Count > 1;
            if (programs.FirstOrDefault() != null)
            {
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    ProgramInformation form = new ProgramInformation(this, _context)
                    {
                        MyProgram = programs.FirstOrDefault(),
                        MyStreamingEndpoints = dataGridViewStreamingEndpointsV.DisplayedStreamingEndpoints, // we pass this information if user open asset info from the program info dialog box
                        MultipleSelection = multiselection
                    };

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        var modifications = form.Modifications;

                        if (multiselection)
                        {
                            var formSettings = new SettingsSelection("programs", modifications);

                            if (formSettings.ShowDialog() != DialogResult.OK)
                            {
                                return;
                            }
                            else
                            {
                                modifications = (ExplorerProgramModifications)formSettings.SettingsObject;
                            }
                        }

                        foreach (var program in programs)
                        {
                            if (modifications.ArchiveWindow)
                            {
                                program.ArchiveWindowLength = form.archiveWindowLength;
                            }
                            if (modifications.Description)
                            {
                                program.Description = form.ProgramDescription;
                            }

                            await Task.Run(() => ProgramExecuteAsync(program.UpdateAsync, program, "updated"));
                        }
                    }
                }
                finally
                {
                    this.Cursor = Cursors.Arrow;
                }
            }
        }