Exemplo n.º 1
0
        private void OnItemAdd(object item)
        => _logger.OnSingleEntryCall <Component>(() =>
        {
            var appointment = item as Outlook.AppointmentItem;
            if (appointment == null)
            {
                return;
            }
            if (appointment.SafeCheck(_ => _.ResponseStatus != Outlook.OlResponseStatus.olResponseAccepted, true))
            {
                return;
            }

            using (var rootFolder = CWExt.AsCW((Outlook.Folder)appointment.Parent))
                if (!rootFolder.Ref.FolderPath.StartsWith(@"\\"))
                {
                    return;
                }

            var window         = new CalendarsAndCategoriesWindow();
            window.DataContext = new CalendarsAndCategoriesModel(
                _env,
                FuncExtensions
                .ApplyParams <CalendarsAndCategoriesModel, Outlook.AppointmentItem>(OnApply, appointment)
                .IfTrueThenCloseWindow(window),
                FuncExtensions
                .AlwaysTrue <CalendarsAndCategoriesModel>()
                .IfTrueThenCloseWindow(window)
                );
            window.Title = Resources.OnAddAppointmentHandler_Caption;
            window.ShowDialog(_logger);
        });
Exemplo n.º 2
0
        public void Execute()
        {
            var window = new CalendarsWindow();

            window.Title       = Resources.SetDefaultCalendars_Caption;
            window.DataContext = new CalendarsModel(
                _env,
                FuncExtensions
                .IfTrueThenCloseWindow <CalendarsModel>(OnApply, window),
                FuncExtensions
                .AlwaysTrue <CalendarsModel>()
                .IfTrueThenCloseWindow(window)
                );
            window.ShowDialog(_logger);
        }