Beispiel #1
0
        public IDictionary <string, string> GetAllProperties()
        {
            IDictionary <string, string> baseDict = BaseShellItem.GetAllProperties();

            baseDict[AbsolutePathIdentifier] = AbsolutePath;

            //add all registry key values
            if (RegKey.RegistryUser != string.Empty)
            {
                baseDict[Constants.REGISTRY_OWNER] = RegKey.RegistryUser;
            }
            if (RegKey.RegistryUser != string.Empty)
            {
                baseDict[Constants.REGISTRY_SID] = RegKey.RegistrySID;
            }
            if (RegKey.RegistryPath != string.Empty)
            {
                baseDict[Constants.REGISTRY_PATH] = RegKey.RegistryPath;
            }
            if (RegKey.ShellbagPath != string.Empty)
            {
                baseDict[Constants.SHELLBAG_PATH] = RegKey.ShellbagPath;
            }
            if (RegKey.LastRegistryWriteDate != DateTime.MinValue)
            {
                baseDict[Constants.LAST_REG_WRITE] = RegKey.LastRegistryWriteDate.ToString();
            }
            if (RegKey.SlotModifiedDate != DateTime.MinValue)
            {
                baseDict[Constants.SLOT_MODIFIED_DATE] = RegKey.SlotModifiedDate.ToString();
            }


            return(baseDict);
        }
Beispiel #2
0
        public static void PropagatePropertyChanged(string propertyName, Element element, IEnumerable children)
        {
            if (propertyName == null || propertyName == VisualElement.FlowDirectionProperty.PropertyName)
            {
                Element.SetFlowDirectionFromParent(element);
            }

            if (propertyName == null || propertyName == VisualElement.VisualProperty.PropertyName)
            {
                Element.SetVisualfromParent(element);
            }

            if (propertyName == null || propertyName == Shell.NavBarIsVisibleProperty.PropertyName)
            {
                BaseShellItem.PropagateFromParent(Shell.NavBarIsVisibleProperty, element);
            }

            if (propertyName == null || propertyName == Shell.NavBarHasShadowProperty.PropertyName)
            {
                BaseShellItem.PropagateFromParent(Shell.NavBarHasShadowProperty, element);
            }

            if (propertyName == null || propertyName == Shell.TabBarIsVisibleProperty.PropertyName)
            {
                BaseShellItem.PropagateFromParent(Shell.TabBarIsVisibleProperty, element);
            }

            foreach (var child in children)
            {
                if (child is IPropertyPropagationController view)
                {
                    view.PropagatePropertyChanged(propertyName);
                }
            }
        }
Beispiel #3
0
            public ShellLifeCycleState(BaseShellItem baseShellItem)
            {
                var shellContent = baseShellItem.SearchForRoute <ShellContent>(ContentRoute);
                var contentPage  = (shellContent as IShellContentController).GetOrCreateContent();

                baseShellItem.SearchForRoute(ItemRoute).Appearing    += (_, __) => ItemAppearing = true;
                baseShellItem.SearchForRoute(SectionRoute).Appearing += (_, __) => SectionAppearing = true;
                shellContent.Appearing += (_, __) => ContentAppearing = true;
                contentPage.Appearing  += (_, __) => PageAppearing = true;

                baseShellItem.SearchForRoute(ItemRoute).Disappearing    += (_, __) => ItemAppearing = false;
                baseShellItem.SearchForRoute(SectionRoute).Disappearing += (_, __) => SectionAppearing = false;
                shellContent.Disappearing += (_, __) => ContentAppearing = false;
                contentPage.Disappearing  += (_, __) => PageAppearing = false;
            }
Beispiel #4
0
        public void SetCurrentItemWithImplicitlyWrappedShellContent(bool useShellContent)
        {
            var shell = new Shell();

            shell.Items.Add(CreateShellItem());

            BaseShellItem shellElement = null;

            if (useShellContent)
            {
                shellElement = CreateShellContent(shellContentRoute: "TestMe");
            }
            else
            {
                shellElement = CreateShellSection(shellSectionRoute: "TestMe");
            }

            if (useShellContent)
            {
                shell.Items.Add((ShellContent)shellElement);
            }
            else
            {
                shell.Items.Add((ShellSection)shellElement);
            }

            var item2 = shell.Items[1];

            Assert.AreEqual(shellElement.FindParentOfType <ShellItem>(), item2);

            if (useShellContent)
            {
                shell.CurrentItem = (ShellContent)shellElement;
            }
            else
            {
                shell.CurrentItem = (ShellSection)shellElement;
            }

            Assert.AreEqual(2, shell.Items.Count);
            Assert.AreEqual(shellElement.FindParentOfType <ShellItem>(), item2);
            Assert.AreEqual(item2, shell.CurrentItem);
        }
Beispiel #5
0
        public static BaseShellItem SearchForPart(this BaseShellItem part, Func <BaseShellItem, bool> searchBy)
        {
            if (searchBy(part))
            {
                return(part);
            }

            BaseShellItem baseShellItem = null;

            switch (part)
            {
            case IShellItemController item:
                foreach (var section in item.GetItems())
                {
                    baseShellItem = SearchForPart(section, searchBy);
                    if (baseShellItem != null)
                    {
                        return(baseShellItem);
                    }
                }
                break;

            case IShellSectionController section:
                foreach (var content in section.GetItems())
                {
                    baseShellItem = SearchForPart(content, searchBy);
                    if (baseShellItem != null)
                    {
                        return(baseShellItem);
                    }
                }
                break;
            }

            return(null);
        }
Beispiel #6
0
 public static BaseShellItem SearchForRoute(this BaseShellItem shell, string route) =>
 SearchForPart(shell, (p) => p.Route == route);
Beispiel #7
0
 public static T SearchForRoute <T>(this BaseShellItem shell, string route) where T : BaseShellItem =>
 (T)SearchForRoute(shell, route);
Beispiel #8
0
 private static bool IsImplicitRoute(BaseShellItem item) =>
 item.Route.StartsWith("IMPL_");
Beispiel #9
0
 private void TopTabBar_OnItemClick(object sender, BaseShellItem e)
 {
     OnTopTabPressed(e);
 }