Esempio n. 1
0
        public ChartShell(ChartWindow Parent)
        {
            this.Unloaded += (s, e) => SettingsWindow?.Close();

            Parent.PreviewKeyDown += (s, e) => { if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
                                                 {
                                                     GetControl();
                                                 }
            };
            Parent.PreviewKeyUp += (s, e) => { if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
                                               {
                                                   LoseControl();
                                               }
            };

            ContextMenuPopup = new Popup
            {
                Placement = PlacementMode.Mouse,
                Child     = new Border
                {
                    BorderThickness = new Thickness(1),
                    BorderBrush     = Brushes.White,
                    Background      = new SolidColorBrush(Color.FromRgb(30, 30, 30)),
                    Child           = ContextMenuSP
                }
            };
            ContextMenuPopup.MouseEnter += (s, e) => { OverMenu = true; };
            ContextMenuPopup.MouseLeave += (s, e) => { OverMenu = false; };
            Initialized += (s, e) => { ((Grid)this.Content).Children.Add(ContextMenuPopup); };
            this.PreviewMouseLeftButtonDown += (s, e) =>
            { if (!OverMenu)
              {
                  InvokeRemoveHook(); ContextMenuPopup.IsOpen = false;
              }
            };

            //PreviewMouseLeftButtonDown
            Interaction   = e => InstrumentsHandler?.Interaction?.Invoke(e);
            Moving        = e => InstrumentsHandler?.Moving?.Invoke(e);
            PaintingLevel = e => InstrumentsHandler?.PaintingLevel(e);
            PaintingTrend = e => InstrumentsHandler?.PaintingTrend(e);

            //MouseMove
            HookElement   = () => InstrumentsHandler?.HookElement?.Invoke();
            DrawPrototype = () => InstrumentsHandler?.DrawPrototype?.Invoke();
        }
Esempio n. 2
0
        private static IHandlerMapper InitApi(ConfigurationProviderBase prov)
        {
            string root = "api/";
            VerbRestrictingMatchRule verbs = new VerbRestrictingMatchRule(HttpVerbs.GET.ToString(), HttpVerbs.POST.ToString());
            UrlBaseMatchRule         url   = new UrlBaseMatchRule(new string[] { root });

            verbs.NextMatcher = url;

            ServerRouting   router = new ServerRouting();
            SessionIdHeader head   = new SessionIdHeader();

            head.Next = router;
            MatchRuleMapHandler mapper = new MatchRuleMapHandler(head, verbs);

            //add all other handlers
            Session s = new Session();

            router.Map.Add(new UrlBaseMapHandler(s, root + s.BaseUrl));

            Login l = new Login();

            router.Map.Add(new UrlBaseMapHandler(l, root + l.BaseUrl));

            UserAuthorizations au = new UserAuthorizations();

            router.Map.Add(new UrlBaseMapHandler(au, root + au.BaseUrl));

            UserAffiliationHandler uah = new UserAffiliationHandler();

            router.Map.Add(new UrlBaseMapHandler(uah, root + uah.BaseUrl));

            Request req = new Request();

            router.Map.Add(new UrlBaseMapHandler(req, root + req.BaseUrl));

            OrganizationHandler orgs = new OrganizationHandler();

            router.Map.Add(new UrlBaseMapHandler(orgs, root + orgs.BaseUrl));

            SitesHandler sites = new SitesHandler();

            router.Map.Add(new UrlBaseMapHandler(sites, root + sites.BaseUrl));

            ProjectsHandler projs = new ProjectsHandler();

            router.Map.Add(new UrlBaseMapHandler(projs, root + projs.BaseUrl));

            FieldActivitiesHandler fas = new FieldActivitiesHandler();

            router.Map.Add(new UrlBaseMapHandler(fas, root + fas.BaseUrl));

            FileTransferHandler fts = new FileTransferHandler();

            router.Map.Add(new UrlBaseMapHandler(fts, root + fts.BaseUrl));

            InstrumentsHandler inst = new InstrumentsHandler();

            router.Map.Add(new UrlBaseMapHandler(inst, root + inst.BaseUrl));

            PersonsHandler per = new PersonsHandler();

            router.Map.Add(new UrlBaseMapHandler(per, root + per.BaseUrl));

            TaxaHandler tax = new TaxaHandler();

            router.Map.Add(new UrlBaseMapHandler(tax, root + tax.BaseUrl));

            WQHandler wq = new WQHandler();

            router.Map.Add(new UrlBaseMapHandler(wq, root + wq.BaseUrl));

            FishHandler fish = new FishHandler();

            router.Map.Add(new UrlBaseMapHandler(fish, root + fish.BaseUrl));

            VegetationHandler veg = new VegetationHandler();

            router.Map.Add(new UrlBaseMapHandler(veg, root + veg.BaseUrl));

            EntityBundlesHandler ebh = new EntityBundlesHandler();

            router.Map.Add(new UrlBaseMapHandler(ebh, root + ebh.BaseUrl));

            DetsHandler det = new DetsHandler();

            router.Map.Add(new UrlBaseMapHandler(det, root + det.BaseUrl));

            return(mapper);
        }