Beispiel #1
0
        private CarSetupsDialog([NotNull] CarObject car, CarSetupsRemoteSource forceRemoteSource = CarSetupsRemoteSource.None)
        {
            if (car == null)
            {
                throw new ArgumentNullException(nameof(car));
            }

            DataContext          = new ViewModel(car);
            DefaultContentSource = Model.ListUri;

            var linkGroup = new LinkGroupFilterable {
                DisplayName = AppStrings.Main_Setups,
                Source      = Model.ListUri,
                AddAllLink  = true,
                FilterHint  = FilterHints.CarSetups
            };

            foreach (var link in CarSetupsListPage.GetRemoteLinks(car.Id))
            {
                linkGroup.FixedLinks.Add(link);
            }

            if (forceRemoteSource != CarSetupsRemoteSource.None)
            {
                ValuesStorage.Set("CarSetupsDialog_link", CarSetupsListPage.GetRemoteSourceUri(car.Id, forceRemoteSource));
            }

            MenuLinkGroups.Add(linkGroup);
            InitializeComponent();
        }
Beispiel #2
0
        public LinkGroupFilterable OpenSubGroup(string groupKey, string displayName, Uri uri, int limit = 2)
        {
            var groupLinks   = MenuLinkGroups.OfType <LinkGroupFilterable>().Where(x => x.GroupKey == groupKey).ToList();
            var existingLink = groupLinks.FirstOrDefault(x => x.Source == uri);

            if (existingLink == null)
            {
                existingLink = new LinkGroupFilterable {
                    DisplayName = displayName,
                    GroupKey    = groupKey,
                    Source      = uri
                };

                while (groupLinks.Count >= limit)
                {
                    MenuLinkGroups.Remove(groupLinks[0]);
                    groupLinks.RemoveAt(0);
                }

                groupLinks.Add(existingLink);
                MenuLinkGroups.Add(existingLink);

                if (!_subGroupKeys.Contains(groupKey))
                {
                    _subGroupKeys.Add(groupKey);
                    ValuesStorage.Set(KeySubGroupKeys, _subGroupKeys);
                }

                ValuesStorage.Set(GetSubGroupLinksKey(groupKey),
                                  groupLinks.Select(x => Storage.EncodeList(x.DisplayName, x.Source.OriginalString)));
            }

            NavigateTo(uri);
            return(existingLink);
        }
Beispiel #3
0
 public void AddUploadTab()
 {
     if (!UploadTabAdded)
     {
         MenuLinkGroups.Add(uploadtab);
         UploadTabAdded = true;
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            Title = "GraphX for WPF showcase application v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
#if DEBUG
            var lg = new LinkGroup {
                DisplayName = "Debug"
            };
            lg.Links.Add(new Link {
                DisplayName = "Debug", Source = new Uri("Pages/Debug/DebugGraph.xaml", UriKind.Relative)
            });
            MenuLinkGroups.Add(lg);
#endif
            this.CommandBindings.Add(new CommandBinding(LinkCommands.ShowMiniSpecialDialog, OnShowMiniSpecialDialog, OnCanShowMiniSpecialDialog));
        }
        public MainWindow()
        {
            InitializeComponent();

            var dataContext = new MainWindowViewModel();

            this.DataContext = dataContext;

            dataContext.GetMenu();

            foreach (var link in dataContext.Groups)
            {
                MenuLinkGroups.Add(link);
            }
        }
Beispiel #6
0
        private CarSkinsDialog([NotNull] CarObject car)
        {
            if (car == null)
            {
                throw new ArgumentNullException(nameof(car));
            }

            DataContext = new ViewModel(car);

            DefaultContentSource = Model.ListUri;
            MenuLinkGroups.Add(new LinkGroupFilterable {
                DisplayName = AppStrings.Main_Skins,
                Source      = Model.ListUri
            });

            InitializeComponent();
        }
        private TrackSkinsDialog([NotNull] TrackObject track)
        {
            if (track == null)
            {
                throw new ArgumentNullException(nameof(track));
            }

            DataContext          = new ViewModel(track);
            DefaultContentSource = Model.ListUri;
            MenuLinkGroups.Add(new LinkGroupFilterable {
                DisplayName = AppStrings.Main_Skins,
                Source      = Model.ListUri,
                FilterHint  = FilterHints.TrackSkins
            });

            InitializeComponent();
        }
Beispiel #8
0
        private void InitializeSubGroups()
        {
            _subGroupKeys = ValuesStorage.GetStringList(KeySubGroupKeys).ToList();
            foreach (var groupKey in _subGroupKeys)
            {
                foreach (var p in ValuesStorage.GetStringList(GetSubGroupLinksKey(groupKey)))
                {
                    var v = Storage.DecodeList(p).ToList();
                    if (v.Count != 2)
                    {
                        continue;
                    }

                    MenuLinkGroups.Add(new LinkGroupFilterable {
                        DisplayName = v[0],
                        GroupKey    = groupKey,
                        Source      = new Uri(v[1], UriKind.RelativeOrAbsolute)
                    });
                }
            }
        }
        internal void showLinks()
        {
            LinkGroup bib = new LinkGroup {
                DisplayName = "Bibliothèque"
            };

            bib.Links.Add(new Link {
                DisplayName = "Nos livres par rubrique", Source = new Uri("/pages/home/home.xaml", UriKind.RelativeOrAbsolute)
            });
            // bib.Links.Add(new Link { DisplayName = "Nos livres les plus consultés", Source = new Uri("/Content/MostConsulted.xaml", UriKind.RelativeOrAbsolute) });

            LinkGroup achat = new LinkGroup {
                DisplayName = "Service Achat"
            };

            achat.Links.Add(new Link {
                DisplayName = "Bienvenue", Source = new Uri("/pages/achat/Achat.xaml", UriKind.RelativeOrAbsolute)
            });

            MenuLinkGroups.Add(bib);
            MenuLinkGroups.Add(achat);

            ContentSource = bib.Links.First().Source;
        }
Beispiel #10
0
        private void setupMenu()
        {
            for (int i = 0; i < MenuLinkGroups.Count; i++)
            {
                if (MenuLinkGroups[i].GroupKey == "main")
                {
                    MenuLinkGroups.RemoveAt(i--);
                }
            }

            LinkGroup lkgp = new LinkGroup();

            lkgp.DisplayName = "首页";
            lkgp.GroupKey    = "main";
            lkgp.Links.Add(new Link {
                DisplayName = "欢迎页", Source = new Uri("/Views/MainPage.xaml", UriKind.RelativeOrAbsolute)
            });
            lkgp.Links.Add(new Link {
                DisplayName = "修改资料", Source = new Uri("/Views/UserData.xaml", UriKind.RelativeOrAbsolute)
            });
            MenuLinkGroups.Add(lkgp);

            if (DBHelper.currentUser.Group.SALEGOODS || DBHelper.currentUser.Group.RESTOCKGOODS || DBHelper.currentUser.Group.QUERYGOODS || DBHelper.currentUser.Group.EDITGOODS)
            {
                lkgp             = new LinkGroup();
                lkgp.DisplayName = "商品管理";
                lkgp.GroupKey    = "main";
                lkgp.Links.Add(new Link {
                    DisplayName = "库存概况", Source = new Uri("/Views/Goods/Summary.xaml", UriKind.RelativeOrAbsolute)
                });
                lkgp.Links.Add(new Link {
                    DisplayName = DBHelper.currentUser.Group.EDITGOODS ? "商品编辑" : "商品查询", Source = new Uri("/Views/Goods/QueryPage.xaml", UriKind.RelativeOrAbsolute)
                });
                if (DBHelper.currentUser.Group.RESTOCKGOODS)
                {
                    lkgp.Links.Add(new Link {
                        DisplayName = "进货", Source = new Uri("/Views/Goods/Restock.xaml", UriKind.RelativeOrAbsolute)
                    });
                }
                if (DBHelper.currentUser.Group.SALEGOODS)
                {
                    lkgp.Links.Add(new Link {
                        DisplayName = "销售", Source = new Uri("/Views/Goods/Sale.xaml", UriKind.RelativeOrAbsolute)
                    });
                }
                MenuLinkGroups.Add(lkgp);
            }
            if (DBHelper.currentUser.Group.EDITPERSONNEL || DBHelper.currentUser.Group.EDITGROUP)
            {
                lkgp             = new LinkGroup();
                lkgp.DisplayName = "人事管理";
                lkgp.GroupKey    = "main";
                if (DBHelper.currentUser.Group.EDITPERSONNEL)
                {
                    lkgp.Links.Add(new Link {
                        DisplayName = "人事管理", Source = new Uri("/Views/Personnel/User.xaml", UriKind.RelativeOrAbsolute)
                    });
                }
                if (DBHelper.currentUser.Group.EDITGROUP)
                {
                    lkgp.Links.Add(new Link {
                        DisplayName = "职位管理", Source = new Uri("/Views/Personnel/Group.xaml", UriKind.RelativeOrAbsolute)
                    });
                }
                MenuLinkGroups.Add(lkgp);
            }
            if (DBHelper.currentUser.Group.EDITLOG || DBHelper.currentUser.Group.QUERYLOG)
            {
                lkgp             = new LinkGroup();
                lkgp.DisplayName = "操作日志";
                lkgp.GroupKey    = "main";
                lkgp.Links.Add(new Link {
                    DisplayName = "日志", Source = new Uri("/Views/Log.xaml", UriKind.RelativeOrAbsolute)
                });
                MenuLinkGroups.Add(lkgp);
            }
        }