Exemplo n.º 1
1
 public MainTab(int page, TabItem newTab, Image newVerso, Image newRecto, Grid canvas, Grid vGrid, Grid rGrid, Button delBtn, ScatterView SV, ScatterViewItem si, Grid vSwipeGrid, Grid rSwipeGrid, Grid vTranslationGrid, Grid rTranslationGrid, Grid vBoxesGrid, Grid rBoxesGrid, TextBlock headerText, SurfaceWindow1.language language)
 {
     _page = page;
     _tab = newTab;
     _verso = newVerso;
     _recto = newRecto;
     _canvas = canvas;
     _vGrid = vGrid;
     _rGrid = rGrid;
     _SVI = si;
     _delButton = delBtn;
     numFingersRecto = 0;
     numFingersVerso = 0;
     fingerPos = new List<Point>();
     avgTouchPoint = new Point(-1, 0);
     _vSwipeGrid = vSwipeGrid;
     _rSwipeGrid = rSwipeGrid;
     _vTranslationGrid = vTranslationGrid;
     _rTranslationGrid = rTranslationGrid;
     _vBoxesGrid = vBoxesGrid;
     _rBoxesGrid = rBoxesGrid;
     _twoPage = true;
     _SV = SV;
     _headerTB = headerText;
     _currentLanguage = language;
     _previousLanguage = _currentLanguage;
     _worker = new Workers(this);
 }
        //Set position of ScatterViewItems in a ScatterView as organized rows
        public static Point SetPosition(ScatterViewItem svi)
        {
            Point newCenter;

            try
            {
                ScatterView parentSV     = (ScatterView)svi.Parent;
                double      ParentWidth  = parentSV.Width;
                double      ParentHeight = parentSV.Height;
                int         NumberParts  = (int)Math.Floor((ParentWidth / (svi.Width + 10)));
                int         count        = parentSV.Items.Count;
                double      startX       = svi.Width / 2 + 10;
                double      startY       = (svi.Height + 10) / 2;
                int         multiplierX  = (count - 1) % NumberParts;
                int         multiplierY  = (count - 1) / NumberParts;
                newCenter = new Point(startX + multiplierX * (svi.Width + 10), startY + multiplierY * (svi.Height + 10));

                //If newCenter is too low to fit entire svi into the bottom row, increase parentSV height
                if (newCenter.Y > ParentHeight - (svi.Width / 2))
                {
                    parentSV.Height = parentSV.Height + (svi.Height + 10);
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc);
                newCenter = new Point(0, 0);
            }
            return(newCenter);
        }
Exemplo n.º 3
0
        //Differentiates ElementMenu interaction from drag/drop interaction using minimum distance
        //Once minimum distance met, create copy to leave in original spot
        private void L1Module_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            try
            {
                Point current = this.Center;
                if (Math.Abs(Original.Y - current.Y) > 10 || Math.Abs(Original.X - current.X) > 10)
                {
                    L1Module l = sender as L1Module;
                    myClone             = l.clone();
                    myClone.Center      = Original;
                    myClone.BorderBrush = l.BorderBrush;

                    ScatterView parent = l.Parent as ScatterView;
                    parent.Items.Add(myClone);

                    if ((parent.Name == "L1_permTab") || (parent.Name == "L1_manTab"))
                    { //Check if in Level1 and give clone L1-appropriate behavior
                        myClone.Opacity = 0.5;
                        myClone.IsManipulationEnabled = false;
                    }
                    else
                    { //Moving L1Module within L2
                        l.changeParents_SV(parent, sw1.L2.L2_SV);
                    }

                    //Prevent it from continuously creating copies
                    l.ContainerManipulationDelta -= L1Module_ContainerManipulationDelta;
                }
            }
            catch (Exception exc) { Console.WriteLine("L1M Delta \n" + exc); }
        }
        /// <summary>
        ///Constructor
        /// </summary>
        public HotspotIconControl(Canvas parent, ScatterView parentScatterView,Hotspot hotspotData, MultiScaleImage msi )
        {
            InitializeComponent();
            m_hotspotData = hotspotData;
            m_parent = parent;
            _msi = msi;
            m_parentScatterView = parentScatterView;
            m_detailControl = new HotspotDetailsControl(m_parent, m_parentScatterView, m_hotspotData, msi);

            try
            {
                String imgUri = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) +  "\\Data\\Hotspots\\Icons\\normal.png";
                normal = new BitmapImage();
                normal.BeginInit();
                normal.UriSource = new Uri(imgUri, UriKind.Relative);
                normal.CacheOption = BitmapCacheOption.OnLoad;
                normal.EndInit();

                highlighted = new BitmapImage();
                imgUri = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Data\\Hotspots\\Icons\\highlighted.png";
                highlighted.BeginInit();
                highlighted.UriSource = new Uri(imgUri, UriKind.Relative);
                highlighted.CacheOption = BitmapCacheOption.OnLoad;
                highlighted.EndInit();

                WriteableBitmap wbmap = new WriteableBitmap(normal);

            }
            catch (Exception e)
            {

            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            InitializeComponent();

            // Add handlers for window availability events
            AddWindowAvailabilityHandlers();

            //Make the DirList ScatterView accessable globally
            GlobalDirList = this.DirList;

            //Or doing it in HTTP
            JSONMessageWrapper _msg = new JSONMessageWrapper("init", "");
            //Test the connection to the server
            try
            {
                String response = HttpClient.GET("init", _msg.getMessage());
            }
            catch (Exception e)
            {
                this.serverNotResondingDialog.Visibility = Visibility.Visible;
            }

            //TODO DELETE THIS. FOR TESTING ONLY
            //String deviceId = "87841656-3842-40cb-af59-389ee46b23cd";
            //this.getIndexObject(deviceId);
        }
Exemplo n.º 6
0
        //Differentiates ElementMenu interaction from drag/drop interaction
        //Once minimum distance met, create copy to leave in original spot
        private void Part_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            try
            {
                Point x = this.Center;
                if (Math.Abs(Original.Y - x.Y) > 20 || Math.Abs(Original.X - x.X) > 20)
                {
                    Part p = sender as Part;
                    myClone             = p.clone();
                    myClone.Center      = Original; //Put clone in original's place
                    myClone.BorderBrush = p.BorderBrush;

                    ScatterView parent = p.Parent as ScatterView;
                    parent.Items.Add(myClone);

                    if (parent.Name == "L0_resultsSV")
                    {                                          //Check if Level0 and give clone L0-appropriate behavior (e.g. dimming/disabling)
                        myClone.Opacity = 0.5;                 //Visually indicate not selectable
                        myClone.IsManipulationEnabled = false; //Disable manipulation until original's fate determined
                    }
                    else
                    { //Moving Part from L1 parts holder to L1Module build tabs; needs to be in L1_SV during transfer
                        p.changeParents_SV(parent, sw1.L1.L1_SV);
                    }

                    //Prevent it from continuously creating copies
                    p.ContainerManipulationDelta -= Part_ContainerManipulationDelta;
                }
            }
            catch (Exception exc) { Console.WriteLine("Part Delta \n" + exc); }
        }
Exemplo n.º 7
0
 // REFACTOR THIS TO A STATIC CLASS
 public DrawingCanvasHelper(SessionManager _activeSessionManager, InkCanvas _PageInkCanvas, ScatterView _Container, Ellipse _CurrentColor, Image _ColorWheel)
 {
     this.ActiveSessionManager = _activeSessionManager;
     this.PageInkCanvas = _PageInkCanvas;
     this.Container = _Container;
     this.CurrentColor = _CurrentColor;
     this.ColorWheel = _ColorWheel;
 }
Exemplo n.º 8
0
 public IGT(Window handler, Canvas mainCanvas, ScatterView container)
 {
     provider = new SurfaceTwoTouchInputProvider(handler);
     GestureFramework.Initialize(provider, this.LayoutRoot, Assembly.GetExecutingAssembly());
     GestureFramework.EventManager.MultiTouchChanged += new TouchInputProvider.MultiTouchChangeEventHandler(EventManager_MultiTouchChanged);
     loadIGT(provider);
     Container = container;
 }
Exemplo n.º 9
0
        //Removes from current parent and adds to destination parent at same location
        private void changeParents_SV(ScatterView parentSV, ScatterView destination)
        {
            //Point newPoint = this.transformCoords(destination);
            Point newPoint = SurfaceWindow1.transformCoords(this, destination);

            parentSV.Items.Remove(this);
            destination.Items.Add(this);
            this.Center = newPoint;
        }
Exemplo n.º 10
0
        public WebStack(ScatterView sv, Point origin, WebGroup gr, String group, KnowledgeWeb knowledge, LADSArtworkMode.ArtworkModeWindow art, int g)
        {
            groupNo = g;
            artwork = art;
            kw = knowledge;
            _sv = sv;
            _images = gr.getGroupBitmap(group);
            if (_images == null)
                return;

            foreach (BitmapImage i in _images)
            {
                ScatterViewItem svi = new ScatterViewItem();
                svi.MinHeight = 1;
                svi.MinWidth = 1;
                Image img = new Image();
                img.Source = i;

                sviContent content = new sviContent();
                content.g = new Grid();
                content.g.Height = INITIAL_THUMB_HEIGHT;
                content.g.Width = INITIAL_THUMB_HEIGHT;

                content.im = img;

                content.r = new Rectangle();
                content.r.Height = INITIAL_THUMB_HEIGHT;
                content.r.Width = INITIAL_THUMB_HEIGHT;
                content.r.Visibility = Visibility.Collapsed;

                content.g.Children.Add(content.r);
                content.g.Children.Add(content.im);

                content.used = false;

                svi.Content = content.g;
                svi.Tag = content;

                svi.Height = INITIAL_THUMB_HEIGHT;
                svi.Width = INITIAL_THUMB_HEIGHT;
                svi.Orientation = 0;
                svi.CanRotate = false;
                svi.CanMove = false;
                svi.CanScale = false;
                svi.PreviewTouchUp += new EventHandler<System.Windows.Input.TouchEventArgs>(svi_PreviewTouchUp);
                svi.PreviewTouchDown += new EventHandler<TouchEventArgs>(svi_PreviewTouchDown);
                svi.SizeChanged += new SizeChangedEventHandler(svi_SizeChanged);

                knowledge.sviList.Add(svi);

                _svis.Add(svi);
                _sv.Items.Add(svi);
            }

            PositionScatterViewItems(origin);
        }
Exemplo n.º 11
0
        //Moves objects from parent to parent while maintaining a consistent center
        private void changeParents_SV(ScatterView parentSV, ScatterView destinationSV)
        {
            try
            {
                Point newPoint = SurfaceWindow1.transformCoords(this, destinationSV);

                parentSV.Items.Remove(this);
                destinationSV.Items.Add(this);
                this.Center = newPoint;
            }
            catch (Exception exc) { Console.WriteLine("changeParents_SV \n" + exc); }
        }
Exemplo n.º 12
0
        //Determines user intent by checking location of drop against threshold and whether a clone exists (i.e. drag intent)
        private void Part_ContainerManipulationCompleted(object sender, ContainerManipulationCompletedEventArgs e)
        {
            Part        p      = sender as Part;
            ScatterView parent = p.Parent as ScatterView;

            try
            {
                if (!(myClone == null))
                { //Clone has been created, indicating drag interaction
                    if (parent == null)
                    {
                        sw1.L0.L0_resultsSV.Items.Add(p);
                        p.PartInL0();
                        sw1.L0.L0_resultsSV.Items.Remove(p);
                    }
                    else
                    {
                        if (parent.Name == "L0_resultsSV")
                        { //Drops Part into L1
                            p.PartInL0();
                        }
                        else
                        { //Drops Part in L1Module
                            p.PartInL1();
                        }
                        parent.Items.Remove(p);
                    }
                }
                else
                {
                    if (parent == null)
                    {
                        return;        //In Primer Designer's StackPanel
                    }
                    Center = Original; //Reset center so non-drag interactions don't mess up positioning
                    if (parent.Name == "L1_prom" || parent.Name == "L1_rbs" || parent.Name == "L1_cds" || parent.Name == "L1_term")
                    {                  //If in an L1 palette
                        if (p.BorderBrush != Brushes.Gray)
                        {
                            //Restore original border
                            p.BorderBrush = Brushes.Gray;
                        }
                        else
                        {
                            p.BorderBrush = Brushes.Navy;
                        } //highlights border
                    }
                }
            }
            catch (Exception exc) { Console.WriteLine("Part Completed \n" + exc); }
        }
Exemplo n.º 13
0
        private static DependencyObject GetScatterViewCanvas(ScatterView sv)
        {
            if (sv.Items.Count == 0)
            {
                return(null);
            }

            //http://msdn.microsoft.com/en-us/library/ee804791%28v=surface.10%29.aspx for the hierarchy
            Border           b             = VisualTreeHelper.GetChild(sv, 0) as Border;
            ItemsPresenter   p             = VisualTreeHelper.GetChild(b, 0) as ItemsPresenter;
            DependencyObject scatterCanvas = VisualTreeHelper.GetChild(p, 0) as DependencyObject; //ScatterCanvas

            return(scatterCanvas);
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            InitializeComponent();
            pinned = new Dictionary <long, bool>();
            PhoneVisualization.PinnedEvent += Register_Pin;
            AddWindowAvailabilityHandlers();
            Images = new ObservableCollection <DragableImageItem>();
            Thumbs = new ObservableCollection <PhoneThumbVisualization>();

            Images.CollectionChanged  += Images_Changed;
            Thumbs.CollectionChanged  += Thumbs_Changed;
            ImgScatterView.ItemsSource = Images;
            PinnedItems.ItemsSource    = Thumbs;
            scw = ImgScatterView;
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            InitializeComponent();
            pinned = new Dictionary<long, bool>();
            PhoneVisualization.PinnedEvent += Register_Pin;
            AddWindowAvailabilityHandlers();
            Images = new ObservableCollection<DragableImageItem>();
            Thumbs = new ObservableCollection<PhoneThumbVisualization>();

            Images.CollectionChanged += Images_Changed;
            Thumbs.CollectionChanged += Thumbs_Changed;
            ImgScatterView.ItemsSource = Images;
            PinnedItems.ItemsSource = Thumbs;
            scw = ImgScatterView;
        }
        //If scatterviewitem (Part, DS, Seq) swipe to delete
        public void swipeToDelete(ScatterViewItem svi)
        {
            if (svi.Center.X > (L0.Width - 100) || svi.Center.X < 100)
            {
                if (svi.GetType() == typeof(Part) || svi.GetType() == typeof(L1Module))
                {
                    ScatterView palette = new ScatterView();

                    if (svi.GetType() == typeof(Part))
                    {
                        Part p = (Part)svi;
                        palette = (ScatterView)p.MyClone.Parent;
                        palette.Items.Remove(p.MyClone);
                    }
                    if (svi.GetType() == typeof(L1Module))
                    {
                        L1Module l = (L1Module)svi;
                        palette = (ScatterView)l.MyClone.Parent;
                        palette.Items.Remove(l.MyClone);
                    }

                    List <ScatterViewItem> storeSVIList = new List <ScatterViewItem>();
                    foreach (ScatterViewItem m in palette.Items)
                    {
                        storeSVIList.Add(m);
                    }
                    palette.Items.Clear();
                    foreach (ScatterViewItem o in storeSVIList)
                    {
                        palette.Items.Add(o);
                        o.Center = SetPosition(o);
                    }
                    return;
                }
                L0.L0_SV.Items.Remove(svi);
                L1.L1_SV.Items.Remove(svi);
                L2.L2_SV.Items.Remove(svi);
                if (pd1 != null)
                {
                    pd1.MainSV.Items.Remove(svi);
                }
                if (pd2 != null)
                {
                    pd2.MainSV.Items.Remove(svi);
                }
            }
        }
Exemplo n.º 17
0
      public Ruler() {
         filters = new List<iFilter>();
         this.Center = new Point(431, 247);
         this.Height = 75;
         this.MinHeight = 0;
         this.Orientation = 0;
         this.Width = 412;
         this.MaxHeight = 1000;
         this.MaxWidth = 1000;

         ScatterView innerView = new ScatterView();
         this.Content = innerView;
         ImageBrush ib = new ImageBrush();
         ib.ImageSource = HabilisX.Utils.NewEmbededResource("HabilisX.Resources.ruler.png");
         innerView.Background = ib;

      }
Exemplo n.º 18
0
 //When manipulation completed, check location for drop and transfer data to placeholder; then delete
 private void Sites_ContainerManipulationCompleted(object sender, ContainerManipulationCompletedEventArgs e)
 {
     try
     {
         Sites s = sender as Sites;
         if (myClone != null)
         {
             Point pt = SurfaceWindow1.transformCoords(this, pd2.PD2_manual);
             if (pd2.PD2_buildTabs.SelectedIndex == 0) //If Manual is selected
             {
                 VisualTreeHelper.HitTest(pd2.PD2_manual, null, new HitTestResultCallback(sitesCallback), new PointHitTestParameters(pt));
             }
             ScatterView parent = (ScatterView)s.Parent;
             parent.Items.Remove(s);
         }
     }
     catch (Exception exc) { Console.WriteLine(exc); }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            InitializeComponent();

            // Add handlers for window availability events
            AddWindowAvailabilityHandlers();

            ScatterView sv = new ScatterView();
            sv.Items.Add(new Whiteboard()
                {
                    Width = 300,
                    Height = 300
                });

            ISBNField isbn = new ISBNField()
                {
                    Width = 500,
                    Height = 360
                };
            isbn.parentScatter = sv;

            sv.Items.Add(isbn);

            grid.Children.Add(sv);

            DispatcherTimer timer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 15000)
            };
            timer.Tick += delegate { sv.Items.Add(new Whiteboard() { Width = 300, Height = 300 }); };
            timer.Start();

            /*sv.Items.Add(new ScatterViewItem()
            {
                Content = new OurWebBrowser(),
                Width = 800,
                Height = 600
            });*/

            WebFactory factory = new WebFactory(sv);
            factory.NewWebBrowser();
            factory.NewWebBrowser();
            factory.NewWebBrowser();
        }
Exemplo n.º 20
0
        /// <summary>
        /// Constructor
        /// Create un NoteViewModel
        /// </summary>
        /// <param name="center">The center point of the ScatterViewItem </param>
        /// <param name="n">The note in the NoteViewModel</param>
        /// <param name="sv">The ScatterView Parent (here, SessionVM.Notes)</param>
        /// <param name="s">The current SessionViewModel</param>
        public NoteViewModel(Point center, Note n, ScatterView sv, SessionViewModel s)
            : base(s)
        {
            Note = n;

            SVItem = new ScatterViewItem();
            ParentSV = sv;

            SVItem.Center = center;

            SVItem.CanScale = false;
            SVItem.HorizontalAlignment = HorizontalAlignment.Center;
            SVItem.CanRotate = false;
            SVItem.HorizontalAlignment = HorizontalAlignment.Center;

            SetStyle();

            Animation = new NoteAnimation(this, SessionVM);
        }
Exemplo n.º 21
0
        /// <summary>
        /// NoteBubbleViewModel Constructor.
        /// </summary>
        public MelodyBubbleViewModel(MelodyBubble mb, ScatterView sv, SessionViewModel s)
            : base(s)
        {
            MelodyBubble = mb;
            SVItem = new ScatterViewItem();
            ParentSV = sv;

            Random r = new Random();
            SVItem.Center = new Point(r.Next((int)sv.ActualWidth), r.Next((int)(635 * sv.ActualHeight / 1080), (int)sv.ActualHeight));

            SVItem.CanScale = false;
            SVItem.HorizontalAlignment = HorizontalAlignment.Center;
            SVItem.CanRotate = false;
            SVItem.HorizontalAlignment = HorizontalAlignment.Center;

            FrameworkElementFactory bubbleImage = new FrameworkElementFactory(typeof(Image));

            bubbleImage.SetValue(Image.SourceProperty, new ThemeViewModel(SessionVM.Session.Theme, SessionVM).GetMelodyBubbleImageSource(mb.Melody.gesture));

            bubbleImage.SetValue(Image.IsHitTestVisibleProperty, false);

            bubbleImage.SetValue(Image.WidthProperty, (135.0 / 1920.0) * SessionVM.SessionSVI.ActualWidth);
            bubbleImage.SetValue(Image.HeightProperty, (135.0 / 1080.0) * SessionVM.SessionSVI.ActualHeight);

            FrameworkElementFactory touchZone = new FrameworkElementFactory(typeof(Ellipse));
            touchZone.SetValue(Ellipse.FillProperty, Brushes.Transparent);
            touchZone.SetValue(Ellipse.MarginProperty, new Thickness(15));

            FrameworkElementFactory grid = new FrameworkElementFactory(typeof(Grid));
            grid.AppendChild(bubbleImage);
            grid.AppendChild(touchZone);

            ControlTemplate ct = new ControlTemplate(typeof(ScatterViewItem));
            ct.VisualTree = grid;

            Style bubbleStyle = new Style(typeof(ScatterViewItem));
            bubbleStyle.Setters.Add(new Setter(ScatterViewItem.TemplateProperty, ct));
            SVItem.Style = bubbleStyle;

            Animation = new MelodyBubbleAnimation(this, SessionVM);
        }
Exemplo n.º 22
0
        // This next region has all the methods to build needed components

        #region BUILD_COMPONENTS

        void AddControl()
        {
            ScatterViewItem ControlScatterViewItem = new ScatterViewItem();

            ControlScatterViewItem.Width    = 680;
            ControlScatterViewItem.Height   = 90;
            ControlScatterViewItem.CanScale = false;
            ControlScatterViewItem.ZIndex   = 4;
            ControlScatterViewItem.Content  = ControlPanel;



            ControlScatterViewItem.IsTopmostOnActivation = true;
            ControlScatterViewItem.IsContainerActive     = true;

            ControlScatterViewItem.ContainerStaysActive = true;
            ScatterView ControlSV = new ScatterView();

            MainGrid.Children.Add(ControlSV);
            ControlSV.Items.Add(ControlScatterViewItem);
        }
Exemplo n.º 23
0
        public static void EnumSVIs(ScatterView sv, VisitSVI handler)
        {
            DependencyObject canv = GetScatterViewCanvas(sv);

            if (canv == null)
            {
                return;
            }

            int nChildren = VisualTreeHelper.GetChildrenCount(canv);

            for (int i = 0; i < nChildren; ++i)
            {
                DependencyObject child = VisualTreeHelper.GetChild(canv, i);
                var svi = child as ScatterViewItem;
                if (svi != null)
                {
                    handler(svi);
                }
            }
        }
Exemplo n.º 24
0
        //Determines user intent by checking location of drop against threshold and whether a clone exists (i.e. drag intent)
        private void L1Module_ContainerManipulationCompleted(object sender, ContainerManipulationCompletedEventArgs e)
        {
            L1Module    l      = sender as L1Module;
            ScatterView parent = l.Parent as ScatterView;

            try
            {
                if (!(myClone == null))
                {
                    if ((parent.Name == "L1_permTab") || (parent.Name == "L1_manTab"))
                    {
                        //Drop L1Module into L2 or delete
                        l.L1ModuleInL1();
                    }
                    else
                    {
                        //Drop L1Module into L2Module or delete
                        l.L1ModuleInL2();
                    }

                    parent.Items.Remove(l);
                }
                else
                {
                    if (parent.Name == "L2_L1ModulesSV")
                    { //If in L2
                        if (l.BorderBrush != Brushes.White)
                        {
                            //Restore white border
                            l.BorderBrush = Brushes.White;
                        }
                        else
                        {
                            l.BorderBrush = Brushes.Navy;
                        } //highlights border
                    }
                }
            }
            catch (Exception exc) { Console.WriteLine("L1M Completd \n" + exc); }
        }
        //Browser Code
        private void BuildBrowserInScatterView(string s, ScatterView scatterview)
        {
            ScatterViewItem svi = new ScatterViewItem();
            Grid addition = new Grid();

            CustomBrowser webBrower = new CustomBrowser();
            webBrower.scatter = scatterview;
            webBrower.Width = double.NaN; //set it for auto width
            webBrower.Height = double.NaN;
            webBrower.Source = new Uri(s);
            webBrower.ShowCreatedWebView += new ShowCreatedWebViewEventHandler(webBrower_ShowCreatedWebView);

            //newItem.Margin = new Thickness(25.0, 25.0, 25.0, 25.0);
            svi.Padding = new Thickness(25.0, 25.0, 25.0, 25.0);
            //newItem.Content = webBrower;
            WrapPanel wrap = new WrapPanel();
            wrap.Orientation = System.Windows.Controls.Orientation.Vertical;
            //wrap.Children.Add(new SurfaceTextBox());
            wrap.Children.Add(webBrower);

            addition.Children.Add(wrap);
            svi.Content = addition; //Sets the new grid as the SVI content

            //ElementMenuItem check = (ElementMenuItem)sender;

            scatterview.Items.Add(svi);

            ElementMenu menu = new ElementMenu();
            menu.ActivationHost = svi;
            menu.ActivationMode = ElementMenuActivationMode.HostInteraction;
            ElementMenuItem emi = new ElementMenuItem();
            emi.Header = "Close";
            emi.Click += new RoutedEventHandler(ElementCloseMenuItem_Click);
            menu.Items.Add(emi);

            menu.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            menu.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            addition.Children.Add(menu); //adds ElementMenu to the grid
        }
Exemplo n.º 26
0
        //L1 behavior handler: drops L1Modules into L2
        //Checks center against threshold value, below which drop occurs
        //Currently handles Permutations functions of Level 2 (consider moving to L1ModuleInL2())
        private void L1ModuleInL1()
        {
            ScatterView parent = Parent as ScatterView;
            //Places item in L2 if user wants to drop it in
            double yL1        = sw1.L1.Center.Y;
            double yL2        = sw1.L2.Center.Y;
            double yThreshold = yL2 - yL1 - 100; //For a 50 margin and 50 more because the center is relative to L1_SV

            //Check if user is dropping or dumping
            Point transformedCenter = SurfaceWindow1.transformCoords(this, sw1.L1.L1_SV);

            if (transformedCenter.Y > yThreshold) //0 is the top relative to L1_xTabs; adjust accordingly. Need to fix this to a relative height.
            {
                L1Module cloneToL2 = clone();
                sw1.L2.L2_L1ModulesSV.Items.Add(cloneToL2);
                cloneToL2.Center = SurfaceWindow1.SetPosition(cloneToL2);
            }
            else
            { //Dumped; restore function to clone
                myClone.IsManipulationEnabled = true;
                myClone.Opacity = 1;
            }
        }
Exemplo n.º 27
0
        //Checks if ElementMenuItems will be cut off; shifts right to prevent cut
        private void ElementMenu_SubmenuOpened(object sender, RoutedEventArgs e)
        {
            try
            {
                ScatterView sv = (ScatterView)this.Parent;

                if (Center.X < Width * 1.5)
                {
                    foreach (ElementMenuItem item in ElementMenu.Items)
                    {
                        item.Margin = new Thickness(225, -60, 0, 0);
                    }
                }
                else if (Center.X > sv.Width - Width * 1.5)
                {
                    foreach (ElementMenuItem item in ElementMenu.Items)
                    {
                        item.Margin = new Thickness(0, -60, 50, 0);
                    }
                }
            }
            catch (Exception exc) { Console.WriteLine("Exception: " + exc); }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Display a hotspot icon on screen.
        /// </summary>
        public void loadHotspotIcon(int index, Canvas canvasParent, ScatterView scatterViewParent, MultiScaleImage msi)
        {
            if (index >= 0 && index < m_hotspotIcons.Length)
            {
                m_hotspotIcons[index] = new HotspotIconControl(canvasParent, scatterViewParent, m_hotspots[index], msi);
                m_hotspotIcons[index].displayOnScreen(msi);
                m_isOnScreen[index] = true;

                m_hotspotDetails[index] = m_hotspotIcons[index].DetailControl;
            }
        }
Exemplo n.º 29
0
        public SingleWeb(ScatterView parent, double xStart, double yStart, int index, double sides, List<Image> ims, Image main, int group, Canvas lineCanvas, String fileName, KnowledgeWeb web, string path, WebGroup g, LADSArtworkMode.ArtworkModeWindow art)
        {
            artwork = art;
            webGroup = g;

            filePath = path;

            kw = web;

            file = fileName;

            centerX = xStart;
            centerY = yStart;

            groupNo = group;
            vertIndex = index;

            int counter = 0;

            mainArtwork.Content = mainGrid;

            mainArtwork.Center = new Point(xStart, yStart);
            mainArtwork.MinHeight = 1;
            mainArtwork.MinWidth = 1;
            mainArtwork.SizeChanged += new SizeChangedEventHandler(mainArtwork_SizeChanged);
            mainArtwork.PreviewTouchDown += new EventHandler<TouchEventArgs>(mainArtwork_PreviewTouchDown);
            mainArtwork.PreviewTouchUp += new EventHandler<TouchEventArgs>(mainArtwork_PreviewTouchUp);
            mainArtwork.PreviewTouchMove += new EventHandler<TouchEventArgs>(mainArtwork_PreviewTouchMove);
            double xDist = sides * 0.4;
            double yDist = sides * 0.4;

            mainArtwork.Width = xDist;
            mainArtwork.Height = yDist;

            kw.sviList.Add(mainArtwork);

            main.Width = mainArtwork.Width - 10;
            main.Height = mainArtwork.Height - 10;
            mainIm = main;

            WebStack.sviContent content = new WebStack.sviContent();
            content.g = mainGrid;
            content.im = main;
            content.r = mainRect;

            content.r.Width = main.ActualWidth + 10;
            content.r.Height = main.ActualHeight + 10;
            content.r.Visibility = Visibility.Collapsed;
            content.r.Fill = Brushes.Green;

            content.g.Children.Add(content.r);
            content.g.Children.Add(content.im);

            content.used = false;

            mainArtwork.Tag = content;

            startHeight = mainArtwork.Height;
            startWidth = mainArtwork.Width;

            mainArtwork.CanRotate = false;
            mainArtwork.Orientation = 0;

            DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd1.AddValueChanged(mainArtwork, ScatterviewMainChanged);

            parent.Items.Add(mainArtwork);

            String[] enumerate = { "A", "B", "C", "D" };

            for(int j = 0; j < group; j++)
            {
                Image i = ims[j];
                groupArtwork current = new groupArtwork();
                current.sv = new ScatterViewItem();
                current.sv.MinHeight = 1;
                current.sv.MinWidth = 1;
                current.groupGrid = new Grid();

                current.sv.Width = sides * 0.05;
                current.sv.Height = sides * 0.05;
                current.angle = 225 + counter * 90;
                current.sv.Center = new Point(xStart + Math.Cos((current.angle/180.0)*Math.PI) * xDist, yStart + Math.Sin((current.angle/180.0)*Math.PI)*yDist);
                current.sv.CanRotate = false;
                current.sv.Orientation = 0;
                //current.sv.SizeChanged += new SizeChangedEventHandler(sv_SizeChanged);
                //current.sv.PreviewTouchDown += new EventHandler<TouchEventArgs>(sv_TouchDown);
                //current.sv.PreviewTouchUp += new EventHandler<TouchEventArgs>(sv_PreviewTouchUp);
                //current.sv.PreviewTouchMove += new EventHandler<TouchEventArgs>(sv_PreviewTouchMove);

                timerAndRect temp2 = new timerAndRect();
                temp2.rect = new Rectangle();
                i.Height = current.sv.Height - 10;
                i.Width = current.sv.Width - 10;
                temp2.ind = counter+1;

                temp2.rect.Height = i.ActualHeight + 10;
                temp2.rect.Width = i.ActualWidth + 10;

                current.sv.Tag = temp2;

                current.sv.Content = current.groupGrid;
                current.groupGrid.Children.Add(temp2.rect);
                current.groupGrid.Children.Add(i);
                current.im = i;

                DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
                //dpd.AddValueChanged(current.sv, ScatterViewCenterChanged);

                current.st = new WebStack(parent, current.sv.Center, webGroup, enumerate[j],kw,artwork,j);

                //parent.Items.Add(current.sv);

                groupList.Add(current);
                counter++;
            }

            height = sides;
            width = sides;
            parentScatter = parent;
        }
Exemplo n.º 30
0
        public WebFactory(ScatterView scatterView)
        {
            _scatterView = scatterView;

            LastFactory = this;
        }
Exemplo n.º 31
0
 public void resetValues(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar)
 {
     mainScatterView = _mainScatterView;
     bar = _bar;
     win = _win;
     isDocked = false;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScatterViewDiagramManager"/> class.
 /// </summary>
 /// <param name="scatterView">The scatter view.</param>
 public ScatterViewDiagramManager(ScatterView scatterView)
 {
     this.scatterView = scatterView;
     //this.tilesCollection = this.scatterView.TileConnections;
     this.tilesCollection.CollectionChanged += this.OnConnectionChanged;
 }
Exemplo n.º 33
0
 public static void setScatterView(ScatterView _sv)
 {
     sv = _sv;
 }
Exemplo n.º 34
0
        /// <summary>
        /// Display all hotspot icons on screen.
        /// </summary>
        public void loadAllHotspotsIcon(Canvas canvasParent, ScatterView scatterViewParent, MultiScaleImage msi)
        {
            if (m_hotspots != null)
            {
                for (int i = 0; i < m_hotspots.Length; i++)
                {
                    if (m_isSelected[i] == true)
                        loadHotspotIcon(i, canvasParent, scatterViewParent, msi);

                }
            }
        }
Exemplo n.º 35
0
        /// <summary>
        /// Loads a session from a binary file
        /// </summary>
        public void LoadSession()
        {
            SessionSVI.Width = Grid.ActualWidth;
            SessionSVI.Height = Grid.ActualHeight;

            ratio = Grid.ActualWidth / 1920.0;

            string path = "Sessions/sess" + SessionID + ".bin";
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream stream = File.Open(path, FileMode.Open);
            SessionData sd = (SessionData)formatter.Deserialize(stream);
            stream.Close();

            Session = new Session();
            Session.ThemeID = sd.ThemeID;

            switch (Session.ThemeID)
            {
                case 2: Session.Theme = new Theme2(); break;
                case 3: Session.Theme = new Theme3(); break;
                case 4: Session.Theme = new Theme4(); break;
                default: Session.Theme = new Theme1(); break;
            }

            ThemeVM = new ThemeViewModel(Session.Theme, this);
            Converter conv = new Converter();
            Session.StaveTop = new Stave(Session.Theme.InstrumentsTop[0]);
            Session.StaveBottom = new Stave(Session.Theme.InstrumentsBottom[0]);

            Grid.Background = ThemeVM.BackgroundImage;
            PlayBarCache.Background = ThemeVM.PlayBarCache;

            Bubbles = new ScatterView();
            Notes = new ScatterView();
            UpdateSound = new ChangeSoundViewModel(this);
            NotesOnStave = new List<NoteViewModel>();

            NbgVM = new NoteBubbleGeneratorViewModel(Session.NoteBubbleGenerator, this);
            MbgVM = new MelodyBubbleGeneratorViewModel(Session.MelodyBubbleGenerator, this);

            displayTrees(new Thickness(20.0 * ratio, 0, 0, 130.0 * ratio), new Thickness(20.0 * ratio, 0, 0, 580.0 * ratio));

            Play_Button = new Grid();
            Play_Button.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            Play_Button.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Play_Button.Background = ThemeVM.PlayImage;
            Play_Button.Visibility = Visibility.Visible;
            IsPlaying = false;

            Play_Button.PreviewTouchDown += new EventHandler<TouchEventArgs>(Play_Button_TouchDown);

            switch (Session.ThemeID)
            {
                case 2: Grid.Children.Add(ThemeChooser.Bird); break;
                case 3: Grid.Children.Add(ThemeChooser.Dragon); break;
                case 4: Grid.Children.Add(ThemeChooser.Cat); break;
                default: break;
            }
            Grid.Children.Add(Bubbles);
            Grid.Children.Add(Notes);
            Grid.Children.Add(Play_Button);
            Grid.Children.Add(UpdateSound.Grid);
            Grid.Children.Add(NbgVM.Grid);
            Grid.Children.Add(MbgVM.Grid);
            Grid.Children.Add(Theme_Button);
            Grid.Children.Add(Tempo_Button);
            Grid.Children.Add(PlayBar);
            Grid.Children.Add(PlayBarCache);
            Grid.Children.Add(StaveCache);
            Grid.Children.Add(previewGrid);
            Grid.Children.Add(topStaveHighlight);
            Grid.Children.Add(bottomStaveHighlight);

            Grid.SetZIndex(UpdateSound.Grid, 7);
            Grid.SetZIndex(TreeUp.Grid, 6);
            Grid.SetZIndex(TreeDown.Grid, 6);
            Grid.SetZIndex(Bubbles, 5);
            Grid.SetZIndex(Notes, 4);
            Grid.SetZIndex(NbgVM.Grid, 3);
            Grid.SetZIndex(MbgVM.Grid, 3);
            Grid.SetZIndex(Play_Button, 3);
            Grid.SetZIndex(Theme_Button, 3);
            Grid.SetZIndex(Tempo_Button, 3);
            Grid.SetZIndex(previewGrid, 2);
            Grid.SetZIndex(StaveCache, 2);
            Grid.SetZIndex(topStaveHighlight, 2);
            Grid.SetZIndex(bottomStaveHighlight, 2);
            Grid.SetZIndex(PlayBarCache, 1);
            Grid.SetZIndex(PlayBar, 0);
            Grid.SetZIndex(ThemeChooser.Bird, 0);
            Grid.SetZIndex(ThemeChooser.Dragon, 0);
            Grid.SetZIndex(ThemeChooser.Cat, 0);

            Theme_Button.Background = ThemeVM.ThemesImage;

            double XCenter;
            foreach (Note note in sd.StaveTopNotes)
            {
                XCenter = ((note.Position * 60.0 + 120.0) / 1920.0) * Grid.ActualWidth;
                Note newNote = new Note(note);
                NoteViewModel noteVM = new NoteViewModel(new Point(XCenter, (conv.getCenterY(true, note) / 1080.0) * Grid.ActualHeight), newNote, Notes, this);
                Session.StaveTop.AddNote(newNote, newNote.Position);
                Notes.Items.Add(noteVM.SVItem);
                NotesOnStave.Add(noteVM);
            }

            foreach (Note note in sd.StaveBottomNotes)
            {
                XCenter = ((note.Position * 60.0 + 120.0) / 1920.0) * Grid.ActualWidth;
                Note newNote = new Note(note);
                NoteViewModel noteVM = new NoteViewModel(new Point(XCenter, (conv.getCenterY(false, note) / 1080.0) * Grid.ActualHeight), newNote, Notes, this);
                Session.StaveBottom.AddNote(newNote, newNote.Position);
                Notes.Items.Add(noteVM.SVItem);
                NotesOnStave.Add(noteVM);
                Session.StaveBottom.AddNote(noteVM.Note, noteVM.Note.Position);
            }

            switch (sd.bpm)
            {
                default : Tempo_Button.Background = ThemeVM.TempoImage[0]; break;
                case 90: Tempo_Button.Background = ThemeVM.TempoImage[1]; break;
                case 120: Tempo_Button.Background = ThemeVM.TempoImage[2]; break;

            }

            TreeDown.SetInstrument(sd.TopInstrument);
            TreeUp.SetInstrument(sd.BottomInstrument);
            Session.PlayBackgroundSound();

            SetDimensions(Grid.ActualWidth, Grid.ActualHeight);
            //UpdateEveryDimensions(Grid.ActualWidth, Grid.ActualHeight);
            if (sd.bpm == 0)
            {
                Session.ChangeBpm(60);
            }
            else Session.ChangeBpm(sd.bpm);
        }
Exemplo n.º 36
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="width">The real Width</param>
        /// <param name="height">The real Height</param>
        /// <param name="s">The Session</param>
        /// <param name="IDs">List of IDs</param>
        /// <param name="animated">True if animated</param>
        public SessionViewModel(Double width, Double height, Session s, List<int> IDs, bool animated)
        {
            Session = s;
            BeingDeleted = false;
            InitialScale = true;
            removeDeleteButtonsOnTouchUp = false;
            SessionSVI = new ScatterViewItem();
            SessionSVI.Width = width;
            SessionSVI.Height = height;

            ratio = width / 1920.0;
            originalRatio = width / 1920.0;

            ThemeVM = new ThemeViewModel(Session.Theme, this);
            Grid = new Grid();
            UpdateSound = new ChangeSoundViewModel(this);
            Bubbles = new ScatterView();
            Notes = new ScatterView();
            NotesOnStave = new List<NoteViewModel>();
            NbgVM = new NoteBubbleGeneratorViewModel(Session.NoteBubbleGenerator, this);
            MbgVM = new MelodyBubbleGeneratorViewModel(Session.MelodyBubbleGenerator, this);

            Orientation = "bottom";
            SessionSVI.Opacity = 0;
            Bubbles.Visibility = Visibility.Visible;
            Notes.Visibility = Visibility.Visible;

            Grid.Background = (new ThemeViewModel(Session.Theme, this)).BackgroundImage;

            Play_Button = new Grid();
            Play_Button.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            Play_Button.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Play_Button.Background = ThemeVM.PlayImage;
            Play_Button.Visibility = Visibility.Visible;
            IsPlaying = false;

            previewGrid = new Grid();
            ImageBrush previewGridImage = new ImageBrush();
            previewGridImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/previewGrid.png", UriKind.Relative));
            previewGrid.Background = previewGridImage;
            previewGrid.Opacity = 0;
            previewGrid.Margin = new Thickness(150.0 * ratio, 90.0 * ratio, 90.0 * ratio, 480.0 * ratio);

            topStaveHighlight = new Grid();
            ImageBrush tSHImage = new ImageBrush();
            tSHImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/blackStaveHighlight.png", UriKind.Relative));
            topStaveHighlight.Background = tSHImage;
            topStaveHighlight.Opacity = 0;
            topStaveHighlight.Margin = new Thickness(0.0, 60.0 * ratio, 0.0, 480.0 * ratio);

            bottomStaveHighlight = new Grid();
            ImageBrush bSHImage = new ImageBrush();
            bSHImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/whiteStaveHighlight.png", UriKind.Relative));
            bottomStaveHighlight.Background = bSHImage;
            bottomStaveHighlight.Opacity = 0;
            bottomStaveHighlight.Margin = new Thickness(0.0, 60.0 * ratio, 0.0, 480.0 * ratio);

            Play_Button.PreviewTouchDown += new EventHandler<TouchEventArgs>(Play_Button_TouchDown);

            Theme_Button = new Grid();
            Theme_Button.Width = 351;
            Theme_Button.Height = 110;
            Theme_Button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            Theme_Button.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Theme_Button.Margin = new Thickness(0, 0, 100.0 * ratio, 0);
            Theme_Button.Background = ThemeVM.ThemesImage;

            Tempo_Button = new Grid();
            Tempo_Button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            Tempo_Button.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Tempo_Button.Margin = new Thickness(0, 0, 470.0 * ratio, 0);
            Tempo_Button.Background = ThemeVM.TempoImage[1];
            Tempo_Button.PreviewTouchDown += new EventHandler<TouchEventArgs>(Tempo_Button_TouchDown);

            SessionSVI.CanMove = false;
            SessionSVI.CanRotate = false;
            SessionSVI.ShowsActivationEffects = false;

            displayTrees(new Thickness(20.0 * ratio, 0, 0, 130.0 * ratio), new Thickness(20.0 * ratio, 0, 0, 580.0 * ratio));

            PlayBar = new Grid();
            PlayBar.Width = 12.0 * ratio;
            PlayBar.Height = 490.0 * ratio;
            ImageBrush PBImage = new ImageBrush();
            PBImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/play_bar.png", UriKind.Relative));
            PlayBar.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            PlayBar.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            PlayBar.Margin = new Thickness(120.0 * ratio, 99.0 * ratio, 0.0, 0.0);
            PlayBar.Background = PBImage;
            PlayBar.Opacity = 0.0;

            PlayBarCache = new Grid();
            PlayBarCache.Width = 1920.0 * ratio;
            PlayBarCache.Height = 531.0 * ratio;
            PlayBarCache.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            PlayBarCache.Margin = new Thickness(0.0, 98.0 * ratio, 0.0, 0.0);
            PlayBarCache.Background = ThemeVM.PlayBarCache;
            PlayBarCache.Opacity = 0.0;

            StaveCache = new Grid();
            StaveCache.Width = 1920.0 * ratio;
            StaveCache.Height = 491.0 * ratio;
            ImageBrush SCImage = new ImageBrush();
            SCImage.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/staves.png", UriKind.Relative));
            StaveCache.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            StaveCache.Margin = new Thickness(0.0, 98.0 * ratio, 0.0, 0.0);
            StaveCache.Background = SCImage;
            StaveCache.Opacity = 0.0;

            Grid.Children.Add(PlayBar);
            Grid.Children.Add(PlayBarCache);
            Grid.Children.Add(StaveCache);
            Grid.Children.Add(Bubbles);
            Grid.Children.Add(Notes);
            Grid.Children.Add(NbgVM.Grid);
            Grid.Children.Add(MbgVM.Grid);
            Grid.Children.Add(Play_Button);
            Grid.Children.Add(Tempo_Button);
            Grid.Children.Add(UpdateSound.Grid);
            Grid.Children.Add(previewGrid);
            Grid.Children.Add(topStaveHighlight);
            Grid.Children.Add(bottomStaveHighlight);

            Grid.SetZIndex(UpdateSound.Grid, 7);
            Grid.SetZIndex(TreeUp.Grid, 6);
            Grid.SetZIndex(TreeDown.Grid, 6);
            Grid.SetZIndex(Bubbles, 5);
            Grid.SetZIndex(Notes, 4);
            Grid.SetZIndex(NbgVM.Grid, 3);
            Grid.SetZIndex(MbgVM.Grid, 3);
            Grid.SetZIndex(Play_Button, 3);
            Grid.SetZIndex(Theme_Button, 3);
            Grid.SetZIndex(Tempo_Button, 3);
            Grid.SetZIndex(previewGrid, 2);
            Grid.SetZIndex(StaveCache, 2);
            Grid.SetZIndex(topStaveHighlight, 2);
            Grid.SetZIndex(bottomStaveHighlight, 2);
            Grid.SetZIndex(PlayBarCache, 1);
            Grid.SetZIndex(PlayBar, 0);

            SessionSVI.Content = Grid;

            ThemeChooser = new ThemeChooser(this);
            Theme_Button.PreviewTouchDown += new EventHandler<TouchEventArgs>(ThemeChooser.Theme_Button_TouchDown);

            int i = 1;
            while (IDs.Contains(i)) i++;
            SessionID = i;
            IDs.Add(i);

            SetDimensions(width, height);
            SessionSVI.Center = new Point(width / 2.0, height / 2.0);

            if (animated) Animation = new SessionAnimation(this);

            DeleteButton = new SurfaceButton();
            DeleteButton.Visibility = Visibility.Hidden;
            ImageBrush ib = new ImageBrush();
            ib.ImageSource = new BitmapImage(new Uri(@"../../Resources/Images/ui_items/delete-icon.png", UriKind.Relative));
            DeleteButton.Background = ib;
            DeleteButton.Width = 25.0;
            DeleteButton.Height = 25.0;
            DeleteButton.HorizontalAlignment = HorizontalAlignment.Left;
            DeleteButton.VerticalAlignment = VerticalAlignment.Top;
            Grid.Children.Add(DeleteButton);

            Grid.SetZIndex(DeleteButton, 1000);

            DeleteButton.PreviewTouchDown += new EventHandler<TouchEventArgs>(DeleteButton_PreviewTouchDown);

            SessionSVI.SizeChanged += new SizeChangedEventHandler(SessionSVI_SizeChanged);
            SessionSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(SessionSVI_TouchLeave);
        }
Exemplo n.º 37
0
        private void preparePreview(ScatterView _Container)
        {
            this.Width = main.Width;
            this.Height = main.Height;

            this.CanvasItem.Width = this.Width;
            this.CanvasItem.Height = this.Height;
            this.CanvasItem.Center = new Point((this.Width / 2), (this.Height / 2));
            TopMenu.Center = new Point((this.Width - 100), 0);
        }
Exemplo n.º 38
0
 protected override void InnerAdapt(IWidgetContainer container)
 {
     _scatterView = (ScatterView)container.Target;
     container.WidgetHosts.CollectionChanged += WidgetHosts_CollectionChanged;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public HotspotDetailsControl(Canvas parentCanvas, ScatterView parentScatterView, Hotspot hotspotData, MultiScaleImage msi)
 {
     InitializeComponent();
     m_hotspotData = hotspotData;
     m_parentCanvas = parentCanvas;
     m_parentScatterView = parentScatterView;
     m_msi = msi;
     //ScatterViewItem
     this.PreviewMouseWheel += new MouseWheelEventHandler(HotspotDetailsControl_PreviewMouseWheel);
     isOnScreen = false;
     hasVideo = false;
     _hasBeenOpened = false;
     _volume = .5;
        // windowSize = new Size();
     sizeChanged = true;
     firstTime = true;
 }
Exemplo n.º 40
0
        /// <summary>
        /// Specify a hotspot location with respect to its artwork.
        /// </summary>
        public void updateHotspotLocation(int index, Canvas canvasParent, ScatterView scatterViewParent, MultiScaleImage msi)
        {
            if (index >= 0 && index < m_hotspotIcons.Length)
            {
                if (m_isOnScreen[index] == true)
                {
                    m_hotspotIcons[index].updateScreenLocation(msi);

                    if (m_hotspotDetails[index].IsOnScreen == true)
                    {
                        m_hotspotDetails[index].updateScreenLocation(msi);
                    }
                }
            }
        }
Exemplo n.º 41
0
        public void initialize()
        {
            // setting some properties
            timelineAreaHeight = (timelineHeight * timelineCount);
            if (timelineAreaHeight < (canvasWrapper.Height - 60))
            {
                timelineAreaHeight = canvasWrapper.Height - 60; // minimum height to fill UI space on bottom of screen
            }

            timeLineList = new List<timelineInfo>();
            centerY = timelineAreaHeight / 2;

            // mainSV, mainSVI, mainCanvas
            mainSV = new ScatterView();
            mainSV.Height = timelineAreaHeight;
            mainSV.Width = w;

            if (w < 192)
                textWidth = w / 10;
            else
                textWidth = 192;

            timelineRulerTickInterval = (w - textWidth) / 15.0;
            timelineWidth = timelineRulerTickInterval * timelineLength;

            mainSVI = new ScatterViewItem();
            mainSVI.Height = timelineAreaHeight;
            mainSVI.Width = w;
            mainSVI.CanRotate = false;
            mainSVI.CanScale = false;
            mainSVI.Center = new Point(w / 2, timelineAreaHeight / 2);
            mainSVI.Orientation = 0;
            mainSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(mainCanvas_PreviewTouchUp);
            mainSVI.PreviewMouseUp += new MouseButtonEventHandler(mainCanvas_PreviewMouseUp);

            DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd1.AddValueChanged(mainSVI, MainSVICenterChanged); // for scrolling list of timelines (panning up and down)

            mainCanvas = new Canvas();
            mainCanvas.Height = timelineAreaHeight;
            mainCanvas.Width = w;

            mainSVI.Content = mainCanvas;

            leftRightSV = new ScatterView();
            leftRightSV.Width = timelineWidth;
            leftRightSV.Height = timelineAreaHeight;

            leftRightSVI = new ScatterViewItem();
            leftRightSVI.Height = timelineAreaHeight;
            leftRightSVI.Width = timelineWidth;
            centerX_LRScatterView = leftRightSVI.Width / 2;
            centerX_LRScatterView_diff = textWidth;
            leftRightSVI.Center = new Point(centerX_LRScatterView + textWidth, centerY);
            leftRightSVI.Orientation = 0;
            leftRightSVI.CanRotate = false;
            leftRightSVI.CanScale = false;
            DependencyPropertyDescriptor dpd2 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd2.AddValueChanged(leftRightSVI, leftRightSVICenterChanged); // for panning timelines left and right
            scatterViewLR_userDragged = true;

            leftRightSV.Items.Add(leftRightSVI);

            leftRightCanvas = new Canvas();
            leftRightCanvas.Height = timelineAreaHeight;
            leftRightCanvas.Width = timelineWidth;
            leftRightCanvas.Background = (Brush)(new BrushConverter().ConvertFrom("#79aa89"));
            leftRightSVI.Content = leftRightCanvas;

            titleCanvas = new Canvas();
            titleCanvas.Height = timelineAreaHeight;
            titleCanvas.Width = textWidth;

            Rectangle r = new Rectangle();
            r.Height = titleCanvas.Height;
            r.Width = titleCanvas.Width;
            r.Fill = (Brush)(new BrushConverter().ConvertFrom("#093024"));
            titleCanvas.Children.Add(r);

            mainCanvas.Children.Add(leftRightSV);
            mainCanvas.Children.Add(titleCanvas);

            // movable scrub bar and its handle
            movableScrub = new Rectangle();
            movableScrub.Height = timelineAreaHeight;
            movableScrub.Width = 3;
            movableScrub.Fill = Brushes.Yellow;
            movableScrub.Visibility = Visibility.Hidden;

            leftRightCanvas.Children.Add(movableScrub);
            Canvas.SetLeft(movableScrub, 0);
            Canvas.SetZIndex(movableScrub, 12);
            Canvas.SetTop(movableScrub, 0);

            movableScrubHandleBackground = new Rectangle();
            movableScrubHandleBackground.Width = w;
            movableScrubHandleBackground.Height = 40;
            movableScrubHandleBackground.Fill = Brushes.DarkRed;
            movableScrubHandleBackground.TouchDown += new EventHandler<TouchEventArgs>(movableScrubHandleBackground_TouchDown);
            movableScrubHandleBackground.MouseDown +=new MouseButtonEventHandler(movableScrubHandleBackground_MouseDown);
            movableScrubHandleBackground.TouchUp += new EventHandler<TouchEventArgs>(movableScrubHandleBackground_TouchUp);
            movableScrubHandleBackground.MouseUp +=new MouseButtonEventHandler(movableScrubHandleBackground_TouchUp);

            canvasWrapper.Children.Add(movableScrubHandleBackground);
            Canvas.SetLeft(movableScrubHandleBackground, 0);
            Canvas.SetTop(movableScrubHandleBackground, 0);
            Canvas.SetZIndex(movableScrubHandleBackground, 15);

            movableScrubHandle = new Rectangle();
            movableScrubHandle.Width = 40;
            movableScrubHandle.Height = 40;
            movableScrubHandle.Fill = Brushes.Yellow;

            canvasWrapper.Children.Add(movableScrubHandle);
            Canvas.SetLeft(movableScrubHandle, textWidth - 18.5);
            Canvas.SetTop(movableScrubHandle, 0);
            Canvas.SetZIndex(movableScrubHandle, 20);
            DependencyPropertyDescriptor dpd3 = DependencyPropertyDescriptor.FromProperty(Canvas.LeftProperty, typeof(Canvas));
            dpd3.AddValueChanged(movableScrubHandle, movableScrubHandle_CanvasLeftChanged);

            startDragPoint = new Point();
            movableScrubHandle.PreviewTouchDown += new EventHandler<TouchEventArgs>(movableScrubHandle_PreviewTouchDown);
            movableScrubHandle.PreviewMouseDown += new MouseButtonEventHandler(movableScrubHandle_PreviewMouseDown);
            movableScrubHandle.PreviewTouchMove += new EventHandler<TouchEventArgs>(movableScrubHandle_PreviewTouchMove);
            movableScrubHandle.PreviewMouseMove += new MouseEventHandler(movableScrubHandle_PreviewMouseMove);
            movableScrubHandle.PreviewTouchUp += new EventHandler<TouchEventArgs>(movableScrubHandle_PreviewTouchUp);
            movableScrubHandle.PreviewMouseUp += new MouseButtonEventHandler(movableScrubHandle_PreviewMouseUp);
            movableScrubHandle_userDragged = true;

            movableScrubHandleExt = new Rectangle();
            movableScrubHandleExt.Width = 3;
            movableScrubHandleExt.Height = 20;
            movableScrubHandleExt.Fill = Brushes.Yellow;

            canvasWrapper.Children.Add(movableScrubHandleExt);
            Canvas.SetLeft(movableScrubHandleExt, textWidth);
            Canvas.SetTop(movableScrubHandleExt, 40);
            Canvas.SetZIndex(movableScrubHandleExt, 12);

            tourControlButton = new SurfaceButton();
            tourControlButton.Height = 30;
            tourControlButton.MinHeight = 30;
            tourControlButton.Width = 70;
            tourControlButton.Padding = new Thickness(7, 1, 7, 0);

            //adding triangle for pause/play button
            Grid g = new Grid();
            g.Height = 30;
            g.Width = 100;
            g.HorizontalAlignment = HorizontalAlignment.Left;
            Polygon p = new Polygon();
            PointCollection ppoints = new PointCollection();
            ppoints.Add(new System.Windows.Point(4, 5));
            ppoints.Add(new System.Windows.Point(4, 26));
            ppoints.Add(new System.Windows.Point(23, 14));
            p.Points = ppoints;
            p.Fill = Brushes.Green;
            p.Visibility = Visibility.Visible;
            p.Margin = new Thickness(0, 0, 0, 0);
            p.Stroke = Brushes.Black;
            p.StrokeThickness = 1;
            p.HorizontalAlignment = HorizontalAlignment.Left;
            p.VerticalAlignment = VerticalAlignment.Center;
            p.Height = 36;
            p.Width = 30;

            Polygon pause = new Polygon();
            PointCollection pausepoints = new PointCollection();
            pausepoints.Add(new System.Windows.Point(29, -1));
            pausepoints.Add(new System.Windows.Point(29, 22));
            pausepoints.Add(new System.Windows.Point(37, 22));
            pausepoints.Add(new System.Windows.Point(37, -1));
            pause.Points = pausepoints;
            pause.Fill = Brushes.Blue;
            //p.Opacity = 1;
            pause.Visibility = Visibility.Visible;
            pause.Margin = new Thickness(0, 0, 0, 0);
            pause.Stroke = Brushes.Black;
            pause.StrokeThickness = 1;
            pause.HorizontalAlignment = HorizontalAlignment.Left;
            pause.VerticalAlignment = VerticalAlignment.Center;

            Polygon pause2 = new Polygon();
            PointCollection pausepoints2 = new PointCollection();
            pausepoints2.Add(new System.Windows.Point(43, -1));
            pausepoints2.Add(new System.Windows.Point(43, 22));
            pausepoints2.Add(new System.Windows.Point(51, 22));
            pausepoints2.Add(new System.Windows.Point(51, -1));
            pause2.Points = pausepoints2;
            pause2.Fill = Brushes.Blue;
            pause2.Visibility = Visibility.Visible;
            pause2.Margin = new Thickness(0, 0, 0, 0);
            pause2.Stroke = Brushes.Black;
            pause2.StrokeThickness = 1;
            pause2.HorizontalAlignment = HorizontalAlignment.Left;
            pause2.VerticalAlignment = VerticalAlignment.Center;

            g.Children.Add(p);
            g.Children.Add(pause);
            g.Children.Add(pause2);
            g.Visibility = Visibility.Visible;
            tourControlButton.Content = g;

            tourControlButton.HorizontalContentAlignment = HorizontalAlignment.Center;
            tourControlButton.Click += tourSystem.TourControlButton_Click;
            canvasWrapper.Children.Add(tourControlButton);
            Canvas.SetLeft(tourControlButton, textWidth - movableScrubHandle.Width / 2 - 5 - tourControlButton.Width); //+20
            Canvas.SetTop(tourControlButton, (movableScrubHandleBackground.Height - tourControlButton.Height) / 2);
            Canvas.SetZIndex(tourControlButton, 30);

            SurfaceButton tourLengthButton = new SurfaceButton();
            tourLengthButton.Content = "Time";
            tourLengthButton.Height = 30;
            tourLengthButton.MinHeight = 30;
            tourLengthButton.Width = 70;
            tourLengthButton.Click += resetTimeButton_Click;
            tourLengthButton.HorizontalContentAlignment = HorizontalAlignment.Center;
            canvasWrapper.Children.Add(tourLengthButton);
            Canvas.SetLeft(tourLengthButton, 5);
            Canvas.SetTop(tourLengthButton, (movableScrubHandleBackground.Height - tourLengthButton.Height) / 2);
            Canvas.SetZIndex(tourLengthButton, 30);

            timelineAreaTopLeft = new Rectangle();
            timelineAreaTopLeft.Width = textWidth;
            timelineAreaTopLeft.Height = 20;
            timelineAreaTopLeft.Fill = (Brush)(new BrushConverter().ConvertFrom("#5a675f"));

            canvasWrapper.Children.Add(timelineAreaTopLeft);
            Canvas.SetLeft(timelineAreaTopLeft, 0);
            Canvas.SetTop(timelineAreaTopLeft, 40);
            Canvas.SetZIndex(timelineAreaTopLeft, 15);

            canvasWrapper.Children.Add(tourSeekBarTimerCount);
            canvasWrapper.Children.Add(tourSeekBarLength);
            Canvas.SetLeft(tourSeekBarTimerCount, 0);
            Canvas.SetTop(tourSeekBarTimerCount, 35);
            Canvas.SetZIndex(tourSeekBarTimerCount, 15);
            tourSeekBarTimerCount.Foreground = Brushes.Yellow;
            tourSeekBarTimerCount.Content = "00:00";
            Canvas.SetLeft(tourSeekBarLength, 42);
            Canvas.SetTop(tourSeekBarLength, 35);
            Canvas.SetZIndex(tourSeekBarLength, 15);
            tourSeekBarLength.Foreground = Brushes.White;
            tourSeekBarLength.Content = "/ 00:00";

            timelineRulerSV = new ScatterView();
            timelineRulerSV.Width = timelineWidth;
            timelineRulerSV.Height = 20.0;

            timelineRulerSVI = new ScatterViewItem();
            timelineRulerSVI.Width = timelineWidth;
            timelineRulerSVI.MinHeight = 0.0; // Apparently, a ScatterViewItem's MinHeight is 80.  Microsoft should document stuff like this.
            timelineRulerSVI.Height = 20.0;
            timelineRulerSVI.Center = new Point(centerX_LRScatterView, timelineRulerSVI.Height / 2);
            timelineRulerSVI.Orientation = 0;
            timelineRulerSVI.CanRotate = false;
            timelineRulerSVI.CanScale = false;
            timelineRulerSVI.Background = new SolidColorBrush(Colors.Transparent);
            timelineRulerSV.Items.Add(timelineRulerSVI);
            DependencyPropertyDescriptor dpd4 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd2.AddValueChanged(timelineRulerSVI, timelineRulerSVICenterChanged); // for dragging the timeline ruler itself
            timelineRulerSVI_userDragged = true;

            timelineRulerCanvas = new Canvas();
            timelineRulerCanvas.Width = timelineWidth;
            timelineRulerCanvas.Height = 20;
            timelineRulerCanvas.Background = Brushes.Black;
            timelineRulerSVI.Content = timelineRulerCanvas;

            this.addTimelineRulerTickMarks();

            canvasWrapper.Children.Add(timelineRulerSV);
            Canvas.SetLeft(timelineRulerSV, textWidth);
            Canvas.SetTop(timelineRulerSV, 40);
            Canvas.SetZIndex(timelineRulerSV, 10);

            // putting it all together
            mainSV.Items.Add(mainSVI);
            canvasWrapper.Children.Add(mainSV);
            Canvas.SetTop(mainSV, 60);
        }
Exemplo n.º 42
0
 /// <summary>
 /// Specify all hotspots locations with respect to its artwork.
 /// </summary>
 public void updateHotspotLocations(Canvas canvasParent, ScatterView scatterViewParent, MultiScaleImage msi)
 {
     if (m_hotspots != null)
     {
         for (int i = 0; i < m_hotspots.Length; i++)
         {
             updateHotspotLocation(i, canvasParent, scatterViewParent, msi);
         }
     }
 }
 public SurfaceWindowViewModel(ScatterView view)
 {
     _view          = view;
     OpenXPSCommand = new Command(OpenXPS);
 }
Exemplo n.º 44
0
 public static void setScatterView(ScatterView _sv)
 {
     sv = _sv;
 }
Exemplo n.º 45
0
        //constructor for VIDEOS
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, string _targetVid, AssociatedDocListBoxItem _aldbi, LADSVideoBubble _video, VideoItem _vidctrl, String description)
        {
            isVideo = true;
            scatteruri = _targetVid;
            vidBub = _video;
            _helpers = new Helpers();
            _description = description;
            image = new Image();
            aldbi = null;
            String thumbFileName = _targetVid;

            //the video thumbnail filename is the same name with a different extension. This gets that extension
            int decrement = System.IO.Path.GetExtension(thumbFileName).Length;
            thumbFileName = thumbFileName.Remove(thumbFileName.Length - decrement, decrement);
            thumbFileName += ".bmp";
            thumbFileName = System.IO.Path.GetFileName(thumbFileName);
            thumbFileName = "Data\\Videos\\Metadata\\" + thumbFileName;

            //opens in filestream to prevent errors from the file already being open
            FileStream stream = new FileStream(thumbFileName, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;
            stream.Close();

            this.isAnimating = false;
            this.Background = Brushes.LightGray;
            this.AddChild(vidBub);
            this.UpdateLayout();
            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;
            aldbi = _aldbi;

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);
            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            mainScatterView.Items.Add(this);

            Random rnd = new Random();
            Point pt = new Point(rnd.Next((int)(win.ActualWidth * .2 + vidBub.ActualWidth * 3), (int)(win.ActualWidth - vidBub.ActualWidth * 3 - 100)),
                                                           rnd.Next((int)(vidBub.ActualHeight * 3), (int)(win.ActualHeight * .8 - vidBub.ActualHeight * 3)));
            this.SetCurrentValue(CenterProperty, pt);
            this.Orientation = rnd.Next(-20, 20);

            imageURIPath = _targetVid;
            MediaElement vid = vidBub.getVideo();
            vid.MediaOpened += new RoutedEventHandler(video_MediaOpened);
            vid.Loaded += new RoutedEventHandler(video_MediaOpened);
            this.MinHeight = 100;
        }
Exemplo n.º 46
0
        /// <summary>
        /// used by artwork mode, including the tour authoring & playback system
        /// </summary>
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, String imageURIPathParam)
        {
            scatteruri = imageURIPathParam;
            image = new Image();
            aldbi = null;
            _helpers = new Helpers();

            FileStream stream = new FileStream(imageURIPathParam, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;

            this.isAnimating = false;
            this.Background = Brushes.LightGray;
            this.AddChild(image);
            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;

            this.Loaded += new RoutedEventHandler(DockableItem_Loaded);

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);

            mainScatterView.Items.Add(this);
            this.SetCurrentValue(HeightProperty, image.Height);
            this.SetCurrentValue(WidthProperty, image.Width);

            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            Random rnd = new Random();

            this.Background = new SolidColorBrush(Colors.Transparent);
            RoutedEventHandler loadedEventHandler = null;
            loadedEventHandler = new RoutedEventHandler(delegate
            {
                this.Loaded -= loadedEventHandler;
                try
                {
                    Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;
                    ssc = this.Template.FindName("shadow", this) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
                    ssc.Visibility = Visibility.Hidden;
                }
                catch (Exception exc) { }

            });
            this.Loaded += loadedEventHandler;

            imageURIPath = imageURIPathParam;

            stream.Close();
        }
        //If scatterviewitem (Part, DS, Seq) swipe to delete
        public void swipeToDelete(ScatterViewItem svi)
        {
            if (svi.Center.X > (L0.Width - 100) || svi.Center.X < 100)
            {
                if (svi.GetType() == typeof(Part) || svi.GetType() == typeof(L1Module))
                {
                    ScatterView palette = new ScatterView();

                    if (svi.GetType() == typeof(Part))
                    {
                        Part p = (Part)svi;
                        palette = (ScatterView)p.MyClone.Parent;
                        palette.Items.Remove(p.MyClone);
                    }
                    if (svi.GetType() == typeof(L1Module))
                    {
                        L1Module l = (L1Module)svi;
                        palette = (ScatterView)l.MyClone.Parent;
                        palette.Items.Remove(l.MyClone);
                    }

                    List<ScatterViewItem> storeSVIList = new List<ScatterViewItem>();
                    foreach (ScatterViewItem m in palette.Items)
                    {
                        storeSVIList.Add(m);
                    }
                    palette.Items.Clear();
                    foreach (ScatterViewItem o in storeSVIList)
                    {
                        palette.Items.Add(o);
                        o.Center = SetPosition(o);
                    }
                    return;
                }
                L0.L0_SV.Items.Remove(svi);
                L1.L1_SV.Items.Remove(svi);
                L2.L2_SV.Items.Remove(svi);
                if (pd1 != null) pd1.MainSV.Items.Remove(svi);
                if (pd2 != null) pd2.MainSV.Items.Remove(svi);
            }
        }
Exemplo n.º 48
0
        public void addTourEvent(timelineInfo timelineInfoStruct, TourEvent tourEvent, ScatterView timelineSV, double beginTime, double duration)
        {
            ScatterViewItem currentSVI = new ScatterViewItem();
            currentSVI.MinWidth = 10; // don't want it to disappear, but still need it to be touchable (even if resolution is as low as 1024 x 768)
            currentSVI.MinHeight = 10;
            currentSVI.Width = duration * (timelineWidth / timelineLength);
            currentSVI.Height = timelineHeight - 7;
            currentSVI.Background = new SolidColorBrush(Colors.Transparent);
            currentSVI.Orientation = 0;
            currentSVI.CanRotate = false;
            currentSVI.Deceleration = double.NaN; // disables inertia
            currentSVI.Center = new Point((beginTime * (timelineWidth / timelineLength)) + (currentSVI.Width / 2), (timelineHeight / 2) - 2);
            currentSVI.Opacity = .7;
            currentSVI.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(tourEventSVI_ContainerManipulationCompleted);
            currentSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(tourEventSVI_PreviewTouchUp);
            currentSVI.PreviewMouseUp += new MouseButtonEventHandler(tourEventSVI_PreviewTouchUp);
            currentSVI.PreviewMouseDown += tourEventSVI_PreviewMouseDown;

            DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd1.AddValueChanged(currentSVI, tourEventCenterChanged);

            tourEventInfo currentAnimInfo = new tourEventInfo();
            currentAnimInfo.timelineInfoStruct = timelineInfoStruct;
            currentAnimInfo.beginTime = beginTime;
            currentAnimInfo.tourEvent = tourEvent;
            currentAnimInfo.centerY = (timelineHeight / 2) - 2;
            currentAnimInfo.centerX = (beginTime * (timelineWidth / timelineLength)) + (currentSVI.Width / 2);
            currentAnimInfo.originalLoc = beginTime * (timelineWidth / timelineLength);
            Rectangle r = new Rectangle();
            r.Width = currentSVI.Width;
            r.Height = currentSVI.Height;
            Timeline timeline = timelineInfoStruct.timeline;
            if (tourEvent != null)
            {
                LinearGradientBrush fadeInBrush = new LinearGradientBrush();
                fadeInBrush.StartPoint = new Point(0, 0);
                fadeInBrush.EndPoint = new Point(1, 0);
                fadeInBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 0.0));
                fadeInBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 0.7));
                fadeInBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 1.0));
                LinearGradientBrush fadeOutBrush = new LinearGradientBrush();
                fadeOutBrush.StartPoint = new Point(0, 0);
                fadeOutBrush.EndPoint = new Point(1, 0);
                fadeOutBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
                fadeOutBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 0.0));
                fadeOutBrush.GradientStops.Add(new GradientStop((Color)System.Windows.Media.ColorConverter.ConvertFromString("#245c4f"), 0.3));
                switch (tourEvent.type)
                {

                    case TourEvent.Type.fadeInMedia:
                        tourSystem.registerDockableItem((tourEvent as FadeInMediaEvent).media, timeline);
                        r.Fill = fadeInBrush;
                        break;
                    case TourEvent.Type.fadeOutMedia:
                        tourSystem.registerDockableItem((tourEvent as FadeOutMediaEvent).media, timeline);
                        r.Fill = fadeOutBrush;
                        break;
                    case TourEvent.Type.zoomMedia:
                        tourSystem.registerDockableItem((tourEvent as ZoomMediaEvent).media, timeline);
                        r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
                        break;
                    case TourEvent.Type.fadeInPath:
                        r.Fill = fadeInBrush;
                        break;
                    case TourEvent.Type.fadeOutPath:
                        r.Fill = fadeOutBrush;
                        break;
                    case TourEvent.Type.fadeInHighlight:
                        r.Fill = fadeInBrush;
                        break;
                    case TourEvent.Type.fadeOutHighlight:
                        r.Fill = fadeOutBrush;
                        break;
                    case TourEvent.Type.zoomMSI:
                        tourSystem.registerMSI((tourEvent as ZoomMSIEvent).msi, timeline);
                        r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
                        break;
                    default:
                        r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
                        break;

                }
            }
            else
            {
                r.Fill = (Brush)(new BrushConverter().ConvertFrom("#245c4f"));
            }
            currentSVI.Content = r;

            currentAnimInfo.r = r;
            currentSVI.Tag = currentAnimInfo;
            if (tourEvent == null)
                currentSVI.IsManipulationEnabled = false;
            currentSVI.PreviewMouseWheel +=new MouseWheelEventHandler(currentSVI_PreviewMouseWheel);
            currentSVI.SizeChanged += new SizeChangedEventHandler(tourEventSVI_SizeChanged);

            timelineSV.Items.Add(currentSVI);
        }
Exemplo n.º 49
0
        /// <summary>
        /// used by artwork mode
        /// </summary>
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, String imageURIPathParam, AssociatedDocListBoxItem _aldbi, String description)
        {
            scatteruri = imageURIPathParam;
            image = new Image();
            aldbi = null;
            _helpers = new Helpers();
            _description = description;
            FileStream stream = new FileStream(imageURIPathParam, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;
            stream.Close();

            this.isAnimating = false;
            //this.Background = Brushes.LightGray;
            //this.Background.Opacity = 0.0;

            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;
            aldbi = _aldbi;

            if (_description == "")
                _description = "Description not found.";

                descriptionBox = new ScatterViewItem(); ///////
                descriptionLabel = new Label();
                descriptionBox.CanRotate = false;
                descriptionBox.CanScale = false;
                descriptionBox.CanMove = false;
                descriptionLabel.Opacity = .85;
                descriptionLabel.BorderBrush = Brushes.Black;
                descriptionLabel.BorderThickness = new Thickness(2.0);
                if (aldbi != null)
                {
                    descriptionLabel.Content = aldbi.getLabel();
                }
                descriptionLabel.Content += "\nMedia Description (tap media item to reread):\n\n" + _description;
                descriptionLabel.Background = Brushes.Khaki;
                descriptionLabel.Foreground = Brushes.Black;
                descriptionBox.Content = descriptionLabel;

                mainScatterView.Items.Add(descriptionBox);

                descriptionBox.Visibility = Visibility.Collapsed;

            this.AddChild(image);

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);

            mainScatterView.Items.Add(this);
            this.SetCurrentValue(HeightProperty, image.Height);
            this.SetCurrentValue(WidthProperty, image.Width);

            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            Random rnd = new Random();
            Point pt = new Point(rnd.Next((int)(win.ActualWidth * .2 + image.ActualWidth * 3), (int)(win.ActualWidth - image.ActualWidth * 3 - 100)),
                                                          rnd.Next((int)(image.ActualHeight * 3), (int)(win.ActualHeight * .8 - image.ActualHeight * 3)));
            this.SetCurrentValue(CenterProperty, pt);
            this.Orientation = rnd.Next(-20, 20);

            this.Loaded += new RoutedEventHandler(DockableItem_Loaded);

            imageURIPath = imageURIPathParam;
        }