public void ReloadCalendarNavigationTree()
 {
     NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
     {
         NavigationNodeGroupSection.Calendar
     });
 }
        public void GetSecondaryNavigation()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "NavigationEventHandler.GetSecondaryNavigation");
            switch ((NavigationModule)base.GetParameter("m"))
            {
            case NavigationModule.Mail:
                NavigationHost.RenderMailSecondaryNavigation(this.Writer, base.UserContext);
                return;

            case NavigationModule.Calendar:
                if (!base.UserContext.IsFeatureEnabled(Feature.Calendar))
                {
                    throw new OwaSegmentationException("The calendar is disabled");
                }
                using (CalendarFolder folder = Utilities.GetFolder <CalendarFolder>(base.UserContext, base.UserContext.CalendarFolderOwaId, new PropertyDefinition[]
                {
                    ViewStateProperties.CalendarViewType,
                    ViewStateProperties.DailyViewDays
                }))
                {
                    DailyView.RenderSecondaryNavigation(this.Writer, folder, base.UserContext);
                    return;
                }
                break;

            case NavigationModule.Contacts:
                break;

            case NavigationModule.Tasks:
                if (!base.UserContext.IsFeatureEnabled(Feature.Tasks))
                {
                    throw new OwaSegmentationException("Tasks are disabled");
                }
                TaskView.RenderSecondaryNavigation(this.Writer, base.UserContext);
                return;

            case NavigationModule.Options:
                return;

            case NavigationModule.AddressBook:
                DirectoryView.RenderSecondaryNavigation(this.Writer, base.UserContext);
                return;

            case NavigationModule.Documents:
                DocumentLibraryUtilities.RenderSecondaryNavigation(this.Writer, base.UserContext);
                return;

            case NavigationModule.PublicFolders:
                NavigationHost.RenderPublicFolderSecondaryNavigation(this.Writer, base.UserContext);
                return;

            default:
                return;
            }
            if (!base.UserContext.IsFeatureEnabled(Feature.Contacts))
            {
                throw new OwaSegmentationException("The Contacts feature is disabled");
            }
            ContactView.RenderSecondaryNavigation(this.Writer, base.UserContext, false);
        }
Exemple #3
0
        // Token: 0x06002EB5 RID: 11957 RVA: 0x0010BEBC File Offset: 0x0010A0BC
        private void OpenOtherUserCalendar(RecipientInfoAC recipientInfo)
        {
            ExchangePrincipal exchangePrincipal = null;

            if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(recipientInfo.RoutingAddress, out exchangePrincipal))
            {
                if (string.Equals(base.UserContext.MailboxSession.MailboxOwnerLegacyDN, exchangePrincipal.LegacyDn, StringComparison.OrdinalIgnoreCase))
                {
                    throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                }
                try
                {
                    NavigationNodeCollection.AddGSCalendarToSharedFoldersGroup(base.UserContext, exchangePrincipal);
                    OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromGSCalendarLegacyDN(exchangePrincipal.LegacyDn);
                    NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, owaStoreObjectId, new NavigationNodeGroupSection[]
                    {
                        NavigationNodeGroupSection.Calendar
                    });
                    this.RenderOpenOtherUserFolderReponse("IPF.Appointment", owaStoreObjectId);
                    return;
                }
                catch (OwaSharedFromOlderVersionException)
                {
                    throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(995407892), LocalizedStrings.GetNonEncoded(1354015881), true);
                }
            }
            throw new OwaEventHandlerException("Cannot get the exchange principal of the target user when open other user's calendar", LocalizedStrings.GetNonEncoded(1988379659), true);
        }
Exemple #4
0
        public void Move()
        {
            base.ThrowIfCannotActAsOwner();
            StoreObjectId nodeId  = (StoreObjectId)base.GetParameter("srcNId");
            StoreObjectId nodeId2 = (StoreObjectId)base.GetParameter("tgtid");
            int           num     = base.IsParameterSet("mt") ? ((int)base.GetParameter("mt")) : 0;
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            NavigationNode             navigationNode             = navigationNodeCollection.RemoveFolderOrGroupByNodeId(nodeId);

            if (navigationNode == null)
            {
                base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.NotSet);
            }
            else
            {
                int num2;
                int num3;
                if (navigationNodeCollection.TryFindGroupAndNodeIndexByNodeId(nodeId2, out num2, out num3))
                {
                    if (navigationNode is NavigationNodeGroup)
                    {
                        if (num3 >= 0)
                        {
                            throw new OwaInvalidRequestException("The target node must be a navigation node group");
                        }
                        if (num != 1 && num != 2)
                        {
                            throw new OwaInvalidRequestException("Can only move a group before or after another group");
                        }
                        navigationNodeCollection.Insert((num == 2) ? (num2 + 1) : num2, navigationNode as NavigationNodeGroup);
                    }
                    else if (navigationNode is NavigationNodeFolder)
                    {
                        if (num3 >= 0)
                        {
                            if (num != 1 && num != 2)
                            {
                                throw new OwaInvalidRequestException("Can only move a folder before or after another folder");
                            }
                            navigationNodeCollection[num2].Children.Insert((num == 2) ? (num3 + 1) : num3, navigationNode as NavigationNodeFolder);
                        }
                        else
                        {
                            navigationNodeCollection[num2].Children.Add(navigationNode as NavigationNodeFolder);
                        }
                    }
                }
                else
                {
                    base.RenderPartialFailure((navigationNodeGroupSection == NavigationNodeGroupSection.First) ? 817935633 : 444965652, OwaEventHandlerErrorCode.NotSet);
                }
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
            }
            NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
            {
                navigationNodeGroupSection
            });
        }
 /// <summary>
 /// Maps all Routes of <typeparamref name="T"/> to the current <paramref name="host"/>.
 /// </summary>
 /// <typeparam name="T">The type that implements <see cref="IRoutes"/>.</typeparam>
 /// <param name="host">The host to configure.</param>
 /// <param name="vm">The ViewModel factory method.</param>
 /// <param name="view">The View factory method.</param>
 /// <returns>The host.</returns>
 public static NavigationHost MapRoutes <T>(this NavigationHost host, Func <object>?vm, Func <Fragment> view)
     where T : IRoutes
 {
     for (int i = 0; i < T.Routes.Length; i++)
     {
         host.Map(T.Routes[i], vm, view);
     }
     return(host);
 }
Exemple #6
0
        public App()
        {
            InitializeComponent();
            MainNavigationHost = new NavigationHost();
            Locator            = new ViewModelLocator();

            SetupStyleOverrides();
            MergeFixedStyleDescendants();

            MainPage = new MainPage();
        }
Exemple #7
0
 internal static void RenderSecondaryNavigation(TextWriter output, UserContext userContext)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     TaskView.RenderSecondaryNavigationFilter(output, "divTskFlt");
     NavigationHost.RenderNavigationTreeControl(output, userContext, NavigationModule.Tasks);
 }
Exemple #8
0
    protected override void OnCreate(Bundle?savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(R.Layout.shell);

        Host = (NavigationHost)App.Resolve <INavigationHost>();
        //ThemeService.FirstRun(); todo: Move theme service here!

        disposables = new()
        {
            Host.WhenRootPopped.Subscribe(_ => Finish()),
            Host.ShouldPopRoot.RegisterHandler(static c => c.SetOutput(true))
        };
Exemple #9
0
        public App()
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;

            InitializeComponent();
            MainNavigationHost = new NavigationHost();
            Locator            = (ViewModelLocator)Current.Resources["Locator"];

            MainPage = MainNavigationHost;
        }
Exemple #10
0
 // Token: 0x06002781 RID: 10113 RVA: 0x000E096C File Offset: 0x000DEB6C
 internal static void RenderSecondaryNavigation(TextWriter output, UserContext userContext, bool isPicker)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     if (!isPicker)
     {
         ContactView.RenderSecondaryNavigationFilter(output, "divCntFlt");
     }
     NavigationHost.RenderNavigationTreeControl(output, userContext, NavigationModule.Contacts);
 }
 // Token: 0x060021FA RID: 8698 RVA: 0x000C23AC File Offset: 0x000C05AC
 protected void RenderReplaceFolderId()
 {
     if (!string.IsNullOrEmpty(this.archiveRootFolderId))
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append("<div id=\"divReplaceFolderId\" style=\"display:none\" oldfolderid =\"f");
         stringBuilder.Append(Utilities.HtmlEncode(base.SerializedContainerId));
         stringBuilder.Append("\" newfolderid =\"f");
         stringBuilder.Append(Utilities.HtmlEncode(this.archiveRootFolderId));
         stringBuilder.Append("\"></div>");
         base.Response.Write(stringBuilder.ToString());
         NavigationHost.RenderFavoritesAndNavigationTrees(base.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
         {
             NavigationNodeGroupSection.First
         });
     }
 }
Exemple #12
0
        public void GetMailFolderTree()
        {
            ExTraceGlobals.UserOptionsCallTracer.TraceDebug((long)this.GetHashCode(), "OptionsEventHandler.GetMailFolderTree");
            FolderTree folderTree = MailboxFolderTree.CreateMailboxFolderTree(base.UserContext, base.UserContext.MailboxSession, FolderTreeRenderType.MailFolderWithoutSearchFolders, true);
            string     text       = "divFPErr";

            this.Writer.Write("<div id=\"divFPTrR\">");
            Infobar infobar = new Infobar(text, "infobar");

            infobar.Render(this.Writer);
            NavigationHost.RenderTreeRegionDivStart(this.Writer, null);
            NavigationHost.RenderTreeDivStart(this.Writer, "fptree");
            folderTree.ErrDiv = text;
            folderTree.Render(this.Writer);
            NavigationHost.RenderTreeDivEnd(this.Writer);
            NavigationHost.RenderTreeRegionDivEnd(this.Writer);
            this.Writer.Write("</div>");
        }
        public void GetFolderPickerTrees()
        {
            bool             requirePublicFolderTree = (bool)base.GetParameter("pTr");
            FolderPickerTree folderPickerTree        = FolderPickerTree.CreateFolderPickerTree(base.UserContext, requirePublicFolderTree);
            string           text = "divFPErr";

            this.Writer.Write("<div id=\"divFPTrR\">");
            Infobar infobar = new Infobar(text, "infobar");

            infobar.Render(this.Writer);
            NavigationHost.RenderTreeRegionDivStart(this.Writer, null);
            NavigationHost.RenderTreeDivStart(this.Writer, "fptree");
            folderPickerTree.ErrDiv = text;
            folderPickerTree.Render(this.Writer);
            NavigationHost.RenderTreeDivEnd(this.Writer);
            NavigationHost.RenderTreeRegionDivEnd(this.Writer);
            this.Writer.Write("</div>");
        }
Exemple #14
0
        public void Expand()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "TreeEventHandler.Expand");
            string text = (string)base.GetParameter("id");
            bool   flag = false;

            if (OwaStoreObjectId.IsDummyArchiveFolder(text))
            {
                text = base.UserContext.GetArchiveRootFolderIdString();
                flag = !string.IsNullOrEmpty(text);
            }
            this.RenderFolderTreeChangedNode(OwaStoreObjectId.CreateFromString(text), null, true, flag, (FolderTreeRenderType)base.GetParameter("rdt"));
            if (flag)
            {
                NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
                {
                    NavigationNodeGroupSection.First
                });
            }
        }
Exemple #15
0
        public App()
        {
            if (_initialized)
            {
                // TODO: Maybe call OnResume if Android doesn't do it for us.
                return;
            }

            _initialized = true;
#if DEBUG
            Log.Listeners.Add(new DelegateLogListener((_, arg2) => Debug.WriteLine(arg2)));
#endif


            InitializeComponent();
            MainNavigationHost = new NavigationHost();
            Locator            = (ViewModelLocator)Current.Resources["Locator"];

            MainPage = MainNavigationHost;
        }
Exemple #16
0
        public App(string launchedBase64Question = null)
        {
            // If Android's OnCreate has been called again, clear out the IoC container's registry so it's safe to re-init.
            SimpleIoc.Default.Reset();
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                Converters = new List <JsonConverter> {
                    new QuestionJsonConverter()
                }
            };
            InitializeComponent();

            // Report binding failures ✨
            Log.Listeners.Add(new DelegateLogListener((arg1, arg2) => Debug.WriteLine(arg2)));

            // If launchedQuestion isn't null, then the app was started by tapping on
            // a toast notification that contained a question.
            // Hold onto that, and pass it down to the ProfileService.
            _launchedBase64Question = launchedBase64Question;

            MainNavigationHost = new NavigationHost();
        }
Exemple #17
0
        public void SubscribeToInternetCalendar()
        {
            string iCalUrlString = (string)base.GetParameter("iCalUrl");

            try
            {
                SubscribeResultsWebCal subscribeResultsWebCal = WebCalendar.Subscribe(base.UserContext.MailboxSession, iCalUrlString, null);
                OwaStoreObjectId       newFolderId            = OwaStoreObjectId.CreateFromMailboxFolderId(subscribeResultsWebCal.LocalFolderId);
                NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, newFolderId, new NavigationNodeGroupSection[]
                {
                    NavigationNodeGroupSection.Calendar
                });
            }
            catch (InvalidSharingDataException)
            {
                this.SanitizingWriter.Write("<div id=\"err\" _msg=\"badUri\"></div>");
            }
            catch (NotSupportedWithMailboxVersionException)
            {
                throw new OwaInvalidRequestException("Your account isn't set up to allow calendars to be added from the Internet.");
            }
        }
 /// <summary>
 /// Map the Route of <typeparamref name="T"/> to the current <paramref name="host"/>.
 /// </summary>
 /// <typeparam name="T">The type that implements <see cref="IRoute"/>.</typeparam>
 /// <param name="host">The host to configure.</param>
 /// <param name="vm">The ViewModel factory method.</param>
 /// <param name="view">The View factory method.</param>
 /// <returns>The host.</returns>
 public static NavigationHost MapRoute <T>(this NavigationHost host, Func <object>?vm, Func <Fragment> view)
     where T : IRoute
 {
     return(host.Map(T.Route, vm, view));
 }
 public void Next()
 {
     NavigationHost.Navigate(new DemoNavigationScreenViewModel(_i + 1));
 }
Exemple #20
0
        public void AddToFavorites()
        {
            base.ThrowIfCannotActAsOwner();
            OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");

            if (owaStoreObjectId.OwaStoreObjectIdType != OwaStoreObjectIdType.MailBoxObject && owaStoreObjectId.OwaStoreObjectIdType != OwaStoreObjectIdType.ArchiveMailboxObject)
            {
                throw new OwaInvalidRequestException("Only mailbox objects can be added to favorites.");
            }
            using (Folder folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, FolderList.FolderTreeQueryProperties))
            {
                if (Utilities.IsDefaultFolder(folder, DefaultFolderType.Root))
                {
                    throw new OwaInvalidRequestException("Cannot add root folder to favorites.");
                }
                if (!string.IsNullOrEmpty(folder.ClassName) && !ObjectClass.IsOfClass(folder.ClassName, "IPF.Note"))
                {
                    throw new OwaInvalidRequestException("Only mail folder can be added to favorites.");
                }
                if (Utilities.IsDefaultFolder(folder, DefaultFolderType.SearchFolders))
                {
                    throw new OwaInvalidRequestException("Cannot add search folder root to favorites.");
                }
                NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.First);
                navigationNodeCollection.RemoveFolderByLegacyDNandId(((MailboxSession)folder.Session).MailboxOwnerLegacyDN, owaStoreObjectId.StoreObjectId);
                if (base.IsParameterSet("tgtid"))
                {
                    StoreObjectId storeObjectId = (StoreObjectId)base.GetParameter("tgtid");
                }
                if (base.IsParameterSet("tgtid"))
                {
                    int num = navigationNodeCollection[0].Children.FindChildByNodeId((StoreObjectId)base.GetParameter("tgtid"));
                    if (num < 0)
                    {
                        base.RenderPartialFailure(817935633, OwaEventHandlerErrorCode.NotSet);
                    }
                    else
                    {
                        if (base.IsParameterSet("mt"))
                        {
                            int num2 = (int)base.GetParameter("mt");
                            if (num2 != 1 && num2 != 2)
                            {
                                throw new OwaInvalidRequestException("Only before or after is valid.");
                            }
                            if (num2 == 2)
                            {
                                num++;
                            }
                        }
                        navigationNodeCollection.InsertMyFolderToFavorites(folder, num);
                    }
                }
                else
                {
                    navigationNodeCollection.AppendFolderToFavorites(folder);
                }
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
            }
            NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
            {
                NavigationNodeGroupSection.First
            });
        }
Exemple #21
0
        public void OpenOtherUserFolder()
        {
            base.ThrowIfCannotActAsOwner();
            if (base.UserContext.IsExplicitLogon)
            {
                throw new OwaInvalidRequestException("Cannot open other's folder in explict logon mode");
            }
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");

            if (navigationNodeGroupSection == NavigationNodeGroupSection.Contacts || navigationNodeGroupSection == NavigationNodeGroupSection.Tasks)
            {
                throw new OwaInvalidRequestException("Cannot open other's contacts/tasks folder");
            }
            DefaultFolderType defaultFolderType;

            switch (navigationNodeGroupSection)
            {
            case NavigationNodeGroupSection.Mail:
                defaultFolderType = DefaultFolderType.Inbox;
                break;

            case NavigationNodeGroupSection.Calendar:
                defaultFolderType = DefaultFolderType.Calendar;
                break;

            case NavigationNodeGroupSection.Contacts:
                defaultFolderType = DefaultFolderType.Contacts;
                break;

            case NavigationNodeGroupSection.Tasks:
                defaultFolderType = DefaultFolderType.Tasks;
                break;

            default:
                throw new OwaInvalidRequestException("Invalid group section: " + navigationNodeGroupSection.ToString());
            }
            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
            }
            if (defaultFolderType != DefaultFolderType.Calendar)
            {
                Folder folder = null;
                if (base.IsParameterSet("RCP"))
                {
                    RecipientInfoAC   recipientInfoAC   = (RecipientInfoAC)base.GetParameter("RCP");
                    ExchangePrincipal exchangePrincipal = null;
                    if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(recipientInfoAC.RoutingAddress, out exchangePrincipal))
                    {
                        if (string.Equals(base.UserContext.MailboxSession.MailboxOwnerLegacyDN, exchangePrincipal.LegacyDn, StringComparison.OrdinalIgnoreCase))
                        {
                            throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                        }
                        folder = this.GetOtherUserFolder(exchangePrincipal, defaultFolderType);
                    }
                }
                else
                {
                    if (!base.IsParameterSet("Id"))
                    {
                        throw new OwaInvalidRequestException("Must specific one of recipient and folder Id.");
                    }
                    OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
                    if (!owaStoreObjectId.IsOtherMailbox)
                    {
                        throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                    }
                    folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, FolderList.FolderTreeQueryProperties);
                }
                try
                {
                    if (folder == null || !Utilities.CanReadItemInFolder(folder))
                    {
                        Strings.IDs localizedId = 1414246128;
                        switch (navigationNodeGroupSection)
                        {
                        case NavigationNodeGroupSection.Mail:
                            localizedId = -236167850;
                            break;

                        case NavigationNodeGroupSection.Contacts:
                            localizedId = -1505241540;
                            break;

                        case NavigationNodeGroupSection.Tasks:
                            localizedId = -65263937;
                            break;
                        }
                        throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(995407892), LocalizedStrings.GetNonEncoded(localizedId), true);
                    }
                    MailboxSession mailboxSession = folder.Session as MailboxSession;
                    if (navigationNodeGroupSection == NavigationNodeGroupSection.Mail)
                    {
                        OtherMailboxConfigEntry otherMailboxConfigEntry = OtherMailboxConfiguration.AddOtherMailboxSession(base.UserContext, mailboxSession);
                        if (otherMailboxConfigEntry != null)
                        {
                            NavigationHost.RenderOtherMailboxFolderTree(this.Writer, base.UserContext, otherMailboxConfigEntry, true);
                        }
                    }
                    else
                    {
                        NavigationNodeCollection.AddNonMailFolderToSharedFoldersGroup(base.UserContext, folder, navigationNodeGroupSection);
                        OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromStoreObject(folder);
                        NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, owaStoreObjectId2, new NavigationNodeGroupSection[]
                        {
                            navigationNodeGroupSection
                        });
                        this.RenderOpenOtherUserFolderReponse(folder.ClassName, owaStoreObjectId2);
                    }
                }
                finally
                {
                    if (folder != null)
                    {
                        folder.Dispose();
                    }
                }
                return;
            }
            if (!base.IsParameterSet("RCP"))
            {
                throw new OwaInvalidRequestException("Recipient is missing for open other user's calendar request");
            }
            this.OpenOtherUserCalendar((RecipientInfoAC)base.GetParameter("RCP"));
        }
Exemple #22
0
 public NavigationService(NavigationHost navigation, PopupHost popupHost)
 {
     _navHost   = navigation;
     _popupHost = popupHost;
     _navHost.CanGoBackChanged += navHost_CanGoBackChanged;
 }
        public void AddFilterToFavorites()
        {
            string text = ((string)base.GetParameter("fltrSbj")).Trim();

            if (text.Length == 0)
            {
                throw new OwaEventHandlerException("User did not provide name for new folder", LocalizedStrings.GetNonEncoded(-41080803), true);
            }
            if (text.Length > 256)
            {
                text = text.Substring(0, 256);
            }
            base.BindToFolder();
            try
            {
                if (Utilities.IsDefaultFolder(base.ContextFolder, DefaultFolderType.DeletedItems) || Utilities.IsItemInDefaultFolder(base.ContextFolder, DefaultFolderType.DeletedItems) || Utilities.IsFavoritesFilterFolder(base.UserContext, base.ContextFolder))
                {
                    throw new OwaInvalidRequestException("Only normal folder or Outlook search folder can be filtered.");
                }
                if (base.FilteredFolder != null)
                {
                    NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.First);
                    if (navigationNodeCollection.FindFoldersById(base.FilteredFolder.Id.ObjectId).Length > 0)
                    {
                        throw new OwaEventHandlerException("Filtered view has already been added.", LocalizedStrings.GetNonEncoded(-44763698), true);
                    }
                    int num = 0;
                    foreach (NavigationNodeFolder navigationNodeFolder in navigationNodeCollection[0].Children)
                    {
                        if (navigationNodeFolder.IsValid && navigationNodeFolder.IsFilteredView)
                        {
                            num++;
                        }
                    }
                    if (num >= Globals.MaximumFilteredViewInFavoritesPerUser)
                    {
                        string description = string.Format(base.UserContext.UserCulture, LocalizedStrings.GetNonEncoded(-529843556), new object[]
                        {
                            Globals.MaximumFilteredViewInFavoritesPerUser
                        });
                        throw new OwaEventHandlerException("Filtered view exceeds budget.", description, true);
                    }
                    base.FilteredFolder[FolderSchema.SearchFolderAllowAgeout] = false;
                    base.FilteredFolder.DisplayName = text;
                    FolderSaveResult folderSaveResult = base.FilteredFolder.Save();
                    if (folderSaveResult.OperationResult != OperationResult.Succeeded)
                    {
                        if (Utilities.IsFolderNameConflictError(folderSaveResult))
                        {
                            throw new OwaEventHandlerException("Folder name exists", LocalizedStrings.GetNonEncoded(-1782850773), OwaEventHandlerErrorCode.FolderNameExists, true);
                        }
                        throw new OwaEventHandlerException("Fail to save folder properties.", LocalizedStrings.GetNonEncoded(-920350130), true);
                    }
                    else
                    {
                        base.FilteredFolder.Load(FolderList.FolderTreeQueryProperties);
                        NavigationNodeFolder navigationNodeFolder2 = navigationNodeCollection.AppendFolderToFavorites(base.FilteredFolder);
                        navigationNodeFolder2.SetFilterParameter(base.FilterCondition.SourceFolderId.StoreObjectId, base.FilterCondition.GetBooleanFlags(), base.FilterCondition.GetCategories(), base.FilterCondition.From, base.FilterCondition.To);
                        navigationNodeCollection.Save(base.UserContext.MailboxSession);
                        navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.First);
                        NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
                        {
                            NavigationNodeGroupSection.First
                        });
                    }
                }
            }
            finally
            {
                this.EndProcessEvent();
            }
        }
Exemple #24
0
 public NavigationService(NavigationHost navigation)
 {
     _navHost = navigation;
     _navHost.CanGoBackChanged += navHost_CanGoBackChanged;
 }