Exemplo n.º 1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            var src    = (ChannelList)this.comboSource.EditValue;
            var target = (ChannelList)this.comboTarget.EditValue;
            int offset;

            if (int.TryParse(this.comboPrNr.Text, out offset))
            {
                offset -= src.Channels.Min(ch => Math.Max(ch.OldProgramNr, 1));
            }

            bool overwrite = true;

            if (target.GetChannelsByNewOrder().Any(ch => ch.NewProgramNr != -1))
            {
                using (var dlg = new ActionBoxDialog(Resources.ReferenceListForm_btnApply_ConflictHandling))
                {
                    dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Clear, DialogResult.OK, dlg.EmptyList);
                    dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Overwrite, DialogResult.Yes, dlg.Overwrite);
                    dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Keep, DialogResult.No, dlg.CopyList);
                    dlg.AddAction(closeButtonText[1], DialogResult.Cancel, dlg.Cancel);
                    switch (dlg.ShowDialog(this))
                    {
                    case DialogResult.OK:
                        target.Channels.ForEach(ch => ch.NewProgramNr = -1);
                        break;

                    case DialogResult.Yes:
                        //overwrite = true;
                        break;

                    case DialogResult.No:
                        overwrite = false;
                        break;

                    case DialogResult.Cancel:
                        return;
                    }
                }
            }

            main.Editor.ApplyReferenceList(this.serializer.DataRoot, src, target, false, offset, FilterChannel, overwrite, this.cbConsecutive.Checked);
            main.RefreshGrids();
        }
Exemplo n.º 2
0
        private bool PromptSaveAndContinue()
        {
            if (this.dataRoot == null || !this.dataRoot.NeedsSaving)
            return true;

              using (ActionBoxDialog dlg = new ActionBoxDialog(Resources.MainForm_PromptSaveAndContinue_Question))
              {
            dlg.AddAction(Resources.MainForm_PromptSaveAndContinue_Save, DialogResult.Yes, dlg.Save);
            dlg.AddAction(Resources.MainForm_PromptSaveAndContinue_Discard, DialogResult.No, dlg.Discard);
            dlg.AddAction(Resources.MainForm_Cancel, DialogResult.Cancel, dlg.Cancel);
            switch (dlg.ShowDialog(this))
            {
              case DialogResult.Yes: this.SaveFiles(); break;
              case DialogResult.No: break;
              case DialogResult.Cancel: return false;
            }
              }
              return true;
        }
Exemplo n.º 3
0
        private void InitInitialChannelOrder()
        {
            DialogResult res;
              string msg = Resources.MainForm_InitInitialChannelOrder_Question;
              using (ActionBoxDialog dlg = new ActionBoxDialog(msg))
              {
            dlg.AddAction(Resources.MainForm_InitInitialChannelOrder_EmptyList, DialogResult.Cancel, dlg.EmptyList);
            dlg.AddAction(Resources.MainForm_InitInitialChannelOrder_CurrentList, DialogResult.No, dlg.FullList, true);
            dlg.AddAction(Resources.MainForm_InitInitialChannelOrder_ReferenceList, DialogResult.Yes, dlg.CopyList);
            res = dlg.ShowDialog(this);
              }

              if (res == DialogResult.Yes)
            this.BeginInvoke((Action)(()=>this.ShowOpenReferenceFileDialog(false)));
              else if (res == DialogResult.No)
              {
            this.dataRoot.ApplyCurrentProgramNumbers();
            this.RefreshGrid(this.gviewLeft, this.gviewRight);
              }
        }
Exemplo n.º 4
0
        private bool PromptHandlingOfUnsortedChannels()
        {
            bool hasUnsorted = false;
              foreach (var list in this.dataRoot.ChannelLists)
              {
            foreach (var channel in list.Channels)
            {
              if (channel.NewProgramNr < 0)
              {
            hasUnsorted = true;
            break;
              }
            }
              }
              if (!hasUnsorted)
            return true;

              var msg = Resources.MainForm_PromptHandlingOfUnsortedChannels_Question;
              DialogResult res;
              using (var dlg = new ActionBoxDialog(msg))
              {
            dlg.AddAction(Resources.MainForm_PromptHandlingOfUnsortedChannels_Append, DialogResult.Yes, dlg.FullList);
            if (this.currentTvSerializer.Features.CanDeleteChannels)
              dlg.AddAction(Resources.MainForm_PromptHandlingOfUnsortedChannels_Delete, DialogResult.No, dlg.Delete);
            dlg.AddAction(Resources.MainForm_Cancel, DialogResult.Cancel, dlg.Cancel);
            res = dlg.ShowDialog(this);
              }

              if (res == DialogResult.Cancel)
            return false;

              this.editor.AutoNumberingForUnassignedChannels(
              res == DialogResult.Yes ? UnsortedChannelMode.AppendInOrder : UnsortedChannelMode.MarkDeleted);
              return true;
        }