private void TsbSaveViewsClick(object sender, EventArgs e)
        {
            tsbPublishEntity.Enabled = false;
            tsbPublishAll.Enabled = false;
            tsbSaveViews.Enabled = false;
            tsbLoadEntities.Enabled = false;

            var targetViews = lvTargetViews.CheckedItems.Cast<ListViewItem>().Select(i => (Entity)i.Tag).ToList();
            var sourceView = (Entity)lvSourceViews.SelectedItems.Cast<ListViewItem>().First().Tag;

            WorkAsync("Saving views...",
                evt =>
                {
                    var args = (object[])evt.Argument;
                    evt.Result = ViewHelper.PropagateLayout((Entity)args[0], (List<Entity>)args[1], Service);
                },
                evt =>
                {
                    if (((List<Tuple<string, string>>)evt.Result).Count > 0)
                    {
                        var errorDialog = new ErrorList((List<Tuple<string, string>>)evt.Result);
                        errorDialog.ShowDialog();
                    }

                    tsbPublishEntity.Enabled = true;
                    tsbPublishAll.Enabled = true;
                    tsbSaveViews.Enabled = true;
                    tsbLoadEntities.Enabled = true;
                },
                new object[] { sourceView, targetViews });
        }
Esempio n. 2
0
        private void BwTransferViewsWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            CommonDelegates.SetCursor(this, Cursors.Default);

            Controls.Remove(informationPanel);

            if (e.Result == null) return;

            if (((List<Tuple<string, string>>)e.Result).Count > 0)
            {
                var errorDialog = new ErrorList((List<Tuple<string, string>>)e.Result);
                errorDialog.ShowDialog();
            }
            else
            {
                MessageBox.Show("Selected views have been successfully transfered!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }