Example #1
0
        public AdPane(JournalPresentation journal)
        {
            if (journal == null) throw new ArgumentNullException("journal");
            InitializeComponent();

            this.journal = journal;
            this.window = journal.Presentation.Windows[1];

            adType.Properties.Items.AddRange(Names.AdTypes);
            adType.Properties.DropDownRows = Names.AdTypes.Count;

            colMensSeats.Caption = MelaveMalkaSeat.MensSeatsCaption;
            colWomensSeats.Caption = MelaveMalkaSeat.WomensSeatsCaption;

            //The grids are bound indirectly through two FrameworkBindingSource
            //so that they don't re-apply settings at every change.
            paymentsSource.DataMember = pledgesSource.DataMember = null;
            pledgesGrid.DataSource = pledgesSource;
            paymentsGrid.DataSource = paymentsSource;
            SetAd(window.CurrentAd(), force: true);

            adSearcher.Properties.DataSource = new FilteredTable<Pledge>(
                Program.Table<Pledge>(),
                p => p.ExternalSource == "Journal " + journal.Year
            );
            EditorRepository.PersonOwnedLookup.Apply(adSearcher.Properties);
            adSearcher.Properties.Columns.Add(new DataSourceColumn("SubType") { Caption = "Type" });
            adSearcher.Properties.Columns.Insert(0, new DataSourceColumn("ExternalId", 35) { Caption = "ID" });
            adSearcher.Properties.Columns.RemoveAt(adSearcher.Properties.Columns.FindIndex(c => c.Caption == "Zip code"));

            window.Application.WindowSelectionChange += Application_WindowSelectionChange;
        }
Example #2
0
 internal AdShape(JournalPresentation owner, Shape shape, JournalAd row)
 {
     Presentation = owner;
     Shape = shape;
     Row = row;
     adType = Names.AdTypes.First(t => t.Name == row.AdType);
 }
Example #3
0
		public AdFormatter(JournalPresentation presentation, XElement configuredRules) {
			Presentation = presentation;
			rules = (from rule in configuredRules.Elements("FormatRule")
					 from element in rule.Elements()
					 select new FormatRule(GetRegexes(element), rule.Element("Format"))
					).ToList().AsReadOnly();
		}
Example #4
0
 public AdsGridForm(JournalPresentation jp)
 {
     InitializeComponent();
     journal = jp;
     Text = "Journal " + jp.Year + " Ads";
     grid.DataMember = null;
     grid.DataSource = datasource = Program.Table<JournalAd>().Filter(ad => ad.Year == journal.Year);
 }
Example #5
0
        public WarningsForm(JournalPresentation journal)
        {
            if (journal == null) throw new ArgumentNullException("journal");
            InitializeComponent();

            this.journal = journal;
            Text = "Journal " + journal.Year + " Warnings";
            RebindGrid();
            gridView.ActiveFilterCriteria = new OperandProperty("IsSuppressed") == new OperandValue(false);
        }
Example #6
0
        JournalPresentation RegisterJournal(Presentation presentation, bool createTaskPane = true)
        {
            Program.Initialize();   //Force Dialog.DefaultTitle before warning dialogs

            try {
                if (Program.Current.DataContext.Table<Person>().Rows.Count == 0)
                    Program.Current.RefreshDatabase();
            } catch (TargetInvocationException ex) {
                Dialog.ShowError("An error occurred while reading the database.  Please fix the problem and restart PowerPoint.\n\n" + ex.InnerException.Message);
            }

            if (!addedAppHandlers) {
                //Since I only need these handlers if there's a journal open,
                //I only add them now so that they won't load assemblies when
                //they execute throughout the year.
                Application.PresentationCloseFinal += Application_PresentationCloseFinal;
                Application.PresentationSave += Application_PresentationSave;
                addedAppHandlers = true;
            }

            var actualYear = JournalPresentation.GetYear(presentation);
            int parsedYear = 0;
            foreach (var segment in presentation.FullName.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)) {
                if (int.TryParse(segment, out parsedYear) && parsedYear > 2000) {
                    if (parsedYear != actualYear) {
                        if (Dialog.Warn("This journal is in a " + parsedYear + " folder, but the file is linked to the " + actualYear
                                      + " journal.\r\nDo you want to link the file to " + parsedYear + "?"))
                            JournalPresentation.MakeJournal(presentation, parsedYear);
                    }
                    break;  //If we found any year in the path, stop searching
                }
            }
            if (parsedYear < 2000)  //If we didn't find any years in the segments
                Dialog.Show("The journal probably ought to be in a folder for its year.", MessageBoxIcon.Warning);

            var jp = new JournalPresentation(presentation, Program.Current.DataContext);
            openJournals.Add(presentation, jp);
            if (createTaskPane)
                CreateTaskPane(jp);
            return jp;
        }
Example #7
0
 void CreateTaskPane(JournalPresentation jp)
 {
     var pane = CustomTaskPanes.Add(new AdPane(jp), "Ad Details", jp.Presentation.Windows[1]);
     pane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
     pane.Width = 650;
     pane.Visible = true;
 }
Example #8
0
 public void ReplaceJournal(JournalPresentation newJournal)
 {
     this.journal = newJournal;
     SetAd(window.CurrentAd());
 }