Inheritance: Caliburn.Micro.PropertyChangedBase
Beispiel #1
0
 public void Init()
 {           
     tabItem = new StartPanelTabItem();
     tabItem.ModelInstance = new BrowserViewModel();
     tabItem.Name = "Web";
     tabItem.HeaderStyle = TabHeaderStyle.Image;
     tabItem.Image = new BitmapImage(new Uri("pack://application:,,,/csCommon;component/Resources/Icons/ie.png"));
     tabItem.Position = StartPanelPosition.right;
     AppState.AddStartPanelTabItem(tabItem);
 }
Beispiel #2
0
 public void Init()
 {           
     _tabItem = new StartPanelTabItem();
     _tabItem.ModelInstance = new MainMenuViewModel();
     _tabItem.Name = "Main Menu";
     _tabItem.HeaderStyle = TabHeaderStyle.Image;
     _tabItem.Image = new BitmapImage(new Uri("pack://application:,,,/csCommon;component/Resources/Icons/Home.png"));
     
     AppState.AddStartPanelTabItem(_tabItem);
 }
Beispiel #3
0
        public void Init()
        {
            AppState.ShareContracts.Add(new SendToContract());

            if (AppState.Imb.Enabled)
            {
                AppState.Imb.ClientAdded += ImbClientAdded;
                AppState.Imb.ClientRemoved += ImbClientRemoved;
                AppState.Imb.AllClients.CollectionChanged -= AllClients_CollectionChanged;
                AppState.Imb.AllClients.CollectionChanged += AllClients_CollectionChanged;
                AppState.Imb.Imb.OnVariable += Imb_OnVariable;
                AppState.Imb.CommandReceived += Imb_CommandReceived;
                fastMapChangeChannel = AppState.Imb.Imb.Publish(AppState.Imb.Id + ".fastmapextent");
                fastMapInterval = AppState.Config.GetInt("Map.FastMapUpdateInterval", 200);
                AppState.Imb.Status.AddCapability("receivescreenshot");

                AppState.ViewDef.VisibleChanged += ViewDefVisibleChanged;
                AppState.ViewDef.MapManipulationDelta += ViewDefMapManipulationDelta;


                foreach (var c in AppState.Imb.Clients) AddClient(c.Value);
                if (AppState.ViewDef.MapControl != null)
                {
                    AppState.ViewDef.MapControl.ExtentChanged += MapControlExtentChanged;
                    AppState.ViewDef.MapControl.ExtentChanging += MapControlExtentChanging;
                }

                var viewModel = new ContactsViewModel() {Plugin = this};

                spti = new StartPanelTabItem
                {
                    ModelInstance = viewModel,
                    Position = StartPanelPosition.left,
                    HeaderStyle = TabHeaderStyle.Image,
                    Name = "Contacts",
                    
                    Image = new BitmapImage(new Uri(@"pack://application:,,,/csCommon;component/Resources/Icons/person.png", UriKind.RelativeOrAbsolute))
                };

                //AppState.ConfigTabs.Add(new EsriMapSettingsViewModel() { DisplayName = "Map" });

            }

        }
Beispiel #4
0
        public void UpdateButtons()
        {
            if (ShowScreenshotButton && circularMenuItem==null)
            {
                circularMenuItem = new CircularMenuItem {Title = "Take Screenshot"};
                circularMenuItem.Selected += TakeScreenshot;

                circularMenuItem.Id = Guid.NewGuid().ToString();
                circularMenuItem.Icon = "pack://application:,,,/csCommon;component/Resources/Icons/Camerablack.png";
                AppState.AddCircularMenu(circularMenuItem);
            }
            if (!ShowScreenshotButton && circularMenuItem!=null)
            {
                AppState.RemoveCircularMenu(circularMenuItem.Id);
                circularMenuItem = null;
            }

            if (ShowNotebookTab && st==null)
            {
                timeTabViewModel = new NoteTabViewModel() { Plugin = this };

                st = new StartPanelTabItem
                {
                    Name = "Background",
                    HeaderStyle = TabHeaderStyle.Image,
                    Image = new BitmapImage(new Uri("pack://application:,,,/csCommon;component/Resources/Icons/Book-Open.png")),
                    ModelInstance = timeTabViewModel
                };
                AppState.AddStartPanelTabItem(st);
            }
            if (!ShowNotebookTab && st != null)
            {
                AppState.RemoveStartPanelTabItem(st);
                st = null;
            }
        }
Beispiel #5
0
        public void Start()
        {
            IsRunning = true;
            
            var viewModel = new DataSetsViewModel() {Plugin = this};
            ((DashboardsViewModel)screen).Plugin = this;

            spti = new StartPanelTabItem
            {
                ModelInstance = viewModel,
                Position = StartPanelPosition.left,
                HeaderStyle = TabHeaderStyle.Image,
                Name = "Dashboards",
                Image = new BitmapImage(new Uri(@"pack://application:,,,/csCommon;component/Resources/Icons/chart2.png", UriKind.RelativeOrAbsolute))
            };

            AppState.AddStartPanelTabItem(spti);

            updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 250);
            updateTimer.Tick += UpdateSensorSets;
            updateTimer.Start();

            Application.Current.MainWindow.KeyDown += MainWindow_KeyDown;
        }
Beispiel #6
0
        public void Init()
        {
            LayersVM = new LayersViewModel(); // IoC.GetAllInstances(typeof(ILayerSelection)).Where(k => ((ILayerSelection)k).Caption == "Layers").FirstOrDefault() as IMapSelection;


            spti = new StartPanelTabItem
            {
                ModelInstance = LayersVM,
                Position = StartPanelPosition.left,
                HeaderStyle = TabHeaderStyle.Image,
                Name = "Layers",
                Image = new BitmapImage(new Uri(@"pack://application:,,,/csCommon;component/Resources/Icons/layers3.png", UriKind.RelativeOrAbsolute))
            };


            //if (!AppState.LeftTabMenuVisible)
            //{
            //    Element = FloatingHelpers.CreateFloatingElement(viewModel.Caption, DockingStyles.Right, viewModel, Icon, Priority);
            //    Element.ModelInstanceBack = new NewLayerViewModel();
            //    Element.CanFlip = true;
            //    Element.CanScale = true;
            //    //Element.StartSize = new Size(75, 100);
            //    Element.SwitchWidth = 600;
            //    ////Element.StartSize = new Size(50,50);
            //    AppState.FloatingItems.Add(Element);
            //}
        }
Beispiel #7
0
        public void Init() {
            //appStateSettings = AppStateSettings.Instance;
            //isTimelineVisible = AppState.TimelineVisible;
            //UpdateTabs();
            // get file location
            appraisals = new AppraisalList();
            //DefaultFunctions = new List<Guid>();
            AppState.Drop += AppStateDrop;
            
            Load();

            functions.CollectionChanged += (sender, e) => {
                Save();
                switch (e.Action) {
                    case NotifyCollectionChangedAction.Move:
                        UpdateAllAppraisals();
                        break;
                    case NotifyCollectionChangedAction.Add:
                        UpdateAllAppraisals();
                        foreach (var newItem in e.NewItems) {
                            var function = newItem as Function;
                            if (function == null) continue;
                            function.PropertyChanged += OnFunctionPropertyChanged;
                        }
                        break;
                    case NotifyCollectionChangedAction.Replace:
                    case NotifyCollectionChangedAction.Remove:
                        foreach (var oldItem in e.OldItems) {
                            var function = oldItem as Function;
                            if (function == null) continue;
                            function.PropertyChanged -= OnFunctionPropertyChanged;
                        }
                        foreach (var appraisal in SelectedAppraisals) {
                            foreach (Function function in e.OldItems)
                                appraisal.Criteria.RemoveCriterion(function);
                        }
                        break;
                }
            };

            TabViewModel = (AppraisalTabViewModel)IoC.GetInstance(typeof(IAppraisalTab), "");
            TabViewModel.Plugin = this;

            AppraisalTabItem = new StartPanelTabItem
            {
                Name = "Appraisals",
                ModelInstance = TabViewModel,
            };

            FunctionsViewModel = (FunctionsTabViewModel)IoC.GetInstance(typeof(IFunctionsTab), "");
            FunctionsViewModel.Plugin = this;

            FunctionsTabItem = new StartPanelTabItem
            {
                Name = "Functions",
                ModelInstance = FunctionsViewModel
            };

            Application.Current.MainWindow.PreviewKeyUp += MainWindowPreviewKeyUp;
            SelectedAppraisals.CollectionChanged += SelectedAppraisalsCollectionChanged;
           
            AppState.AddStartPanelTabItem(AppraisalTabItem);
            AppState.AddStartPanelTabItem(FunctionsTabItem);
        }
Beispiel #8
0
        public void Init()
        {
            //var viewModel = IoC.GetAllInstances(typeof(IBookmark)).FirstOrDefault() as IBookmark;

            Menu = new CircularMenuItem
            {
                Id    = "Events",
                Title = "test",
                Icon  = "pack://*****:*****@"icons\layers.png";

            AppState.AddStartPanelTabItem(spti);
        }
Beispiel #9
0
        public void UpdateLayerTabs(PoiService service, dsLayer layer)
        {
            var tabVisible = true;
            if (service.Settings != null)
            {
                tabVisible = service.Settings.TabBarVisible;
            }
            // check if it already exists

            Execute.OnUIThread(() =>
            {
                var inst = AppState.StartPanelTabItems.FirstOrDefault(
                    k => k.ModelInstance is TabItemViewModel &&
                    ((TabItemViewModel)k.ModelInstance).Service == service);

                if (inst == null && service.IsInitialized && tabVisible)
                {
                    var ptvm = new TabItemViewModel { Plugin = this, Service = service, Layer = layer };
                    var s = new StartPanelTabItem { Name = service.Name };
                    ptvm.TabItem = s;
                    if (!service.IsLocal || service.Mode == Mode.server)
                    {
                        s.SupportImage =
                            new BitmapImage(
                                new Uri("pack://application:,,,/csCommon;component/Resources/Icons/online.png"));
                    }
                    s.ModelInstance = ptvm;
                    AppState.AddStartPanelTabItem(s);
                }
                else if ((!service.IsInitialized || !tabVisible) && inst != null)
                {
                    AppState.RemoveStartPanelTabItem(inst);
                }
            });
        }
Beispiel #10
0
        public void Start()
        {
            var timeTabViewModel = new TimeTabViewModel() { Plugin = this };

            st = new StartPanelTabItem {
                Name = "Background",
                HeaderStyle = TabHeaderStyle.Image,
                Image = new BitmapImage(new Uri("pack://application:,,,/csCommon;component/Resources/Icons/timetab.png")),
                ModelInstance = timeTabViewModel
            };
            AppState.AddStartPanelTabItem(st);
            IsRunning = true;
        }
Beispiel #11
0
        public void Start()
        {
            IsRunning = true;
            tabItem = new StartPanelTabItem
            {
                ModelInstance = new MapToolsViewModel(),
                Name = "Map Tools",
                HeaderStyle = TabHeaderStyle.Image,
                Image = new BitmapImage(new Uri("pack://application:,,,/csCommon;component/Resources/Icons/tools2.png"))
            };

            AppState.AddStartPanelTabItem(tabItem);

        }
Beispiel #12
0
        private SlideTabItem AddSP(StartPanelTabItem n)
        {
            var ti = new SlideTabItem {
                Item = n,
                Image = n.Image,
                SupportImage = n.SupportImage,
                HeaderStyle = n.HeaderStyle,
                Width = Double.NaN,
                Height = Double.NaN
            };
            n.TabItem = ti;
            //ti.MinWidth = 100;
            //ti.Margin = new Thickness(5,0,5,0);

            var b = ViewLocator.LocateForModel(n.ModelInstance, null, null) as FrameworkElement;
            if (b != null)
            {
                b.HorizontalAlignment = HorizontalAlignment.Stretch;
                b.VerticalAlignment = VerticalAlignment.Stretch;
                ViewModelBinder.Bind(n.ModelInstance, b, null);
                ti.Content = b;
            }

            n.PropertyChanged += (e, s) => {
                ti.SupportImage = n.SupportImage;
                ti.ShowSupportImage = (ti.SupportImage == null) ? Visibility.Collapsed : Visibility.Visible;
                if (s.PropertyName == "IsSelected")
                    if (n.IsSelected && n.IsSelected != ti.IsSelected)
                    {
                        ti.IsSelected = true;
                        ti.Focus();
                    }
//                ti.Visibility = n.IsSelected ? Visibility.Visible: Visibility.Collapsed;
            };

            if (n.Position == StartPanelPosition.bottom) 
            {
                ti.Style = spv.FindResource("TabItemStyle1") as Style;
                ti.Container = spv.MenuBottom;
                spv.tcMenuBottom.Items.Add(ti);
            }
            if (n.Position == StartPanelPosition.left)
            {
                ti.Style = spv.FindResource("TabItemStyle2") as Style;
                ti.Container = spv.MenuLeft;
                ti.Orientation = TabOrientation.Vertical;

                spv.tcMenuLeft.Items.Add(ti);
                spv.tcMenuLeft.SelectedItem = ti;
            }
            if (n.Position == StartPanelPosition.right)
            {
                ti.Style = spv.FindResource("TabItemStyleRight") as Style;
                ti.Container = spv.MenuRight;
                ti.Orientation = TabOrientation.VerticalRight;

                spv.tcMenuRight.Items.Add(ti);
                spv.tcMenuRight.SelectedItem = ti;
            }

            return ti;
        }