/// <summary>
        /// Event wird aufgerufen bei TouchUp auf SafeSelect.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Eventparameter</param>
        private void OptionTouchUp(object sender, TouchEventArgs e)
        {
            // If this contact is the one that was remembered
            if (e.TouchDevice == OptionControlTouchDevice)
            {
                // Forget about this contact.
                OptionControlTouchDevice = null;

                SurfaceButton pressedButton = (SurfaceButton)sender;

                var bc = new BrushConverter();
                RemovingText.Foreground     = new SolidColorBrush(Colors.White);
                AddingText.Foreground       = new SolidColorBrush(Colors.White);
                ConfirmAddRectangle.Fill    = (Brush)bc.ConvertFrom("#FFE2E2E2");
                ConfirmRemoveRectangle.Fill = (Brush)bc.ConvertFrom("#FFE2E2E2");

                if (pressedButton.Margin.Left <= 146 || pressedButton.Margin.Left >= 306)
                {
                    // pass event to SurfaceWindow1.xaml.cs
                    RoutedEventArgs eventargs = new RoutedEventArgs(ModelOverviewControl.AddOrRemoveSelectedEvent);
                    RaiseEvent(eventargs);
                }
                _chosenPanel = ChosenPanel.None;
                // Reset Button
                ResetButton(pressedButton);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                _TriggerButton        = GetTemplateChild("PART_TriggerButton") as SurfaceButton;
                _TriggerButton.Click += TriggerButton_Click;

                _ListBox = GetTemplateChild("PART_ListBox") as SurfaceListBox;
                _ListBox.LayoutUpdated    += ListBox_LayoutUpdated;
                _ListBox.SelectedIndex     = SelectedIndex;
                _ListBox.SelectionChanged += ListBox_SelectionChanged;
                _ListBox.PreviewMouseDown += (sender, e) => HandleClickOrTap(e.OriginalSource);

                Loaded += (sender, e) =>
                {
                    ScatterViewItem svi = this.FindVisualParent <ScatterViewItem>();
                    if (svi != null)
                    {
                        // If hosted within a ScatterViewItem, close whenever the SVI is manipulated.
                        svi.PreviewMouseLeftButtonDown += (a, b) => CloseOnParentInteraction(b.OriginalSource as FrameworkElement);
                        svi.PreviewTouchDown           += (a, b) => CloseOnParentInteraction(b.OriginalSource as FrameworkElement);
                    }
                };
            }

            base.OnApplyTemplate();
        }
Exemplo n.º 3
0
        //private ScatterViewItem _svi;

        public override void OnApplyTemplate()
        {
            if (Execute.InDesignMode) return;
            //csCommon.Resources.FloatingStyles fs = new FloatingStyles();
            //var ct = fs.FindName("SimpleFloatingStyle") as ControlTemplate;
            Loaded += DashboardControl_Loaded;
            base.OnApplyTemplate();
            InitScatterViewEvents();
            Item.PropertyChanged += Item_PropertyChanged;
            //_svi = (ScatterViewItem)Helpers.FindElementOfTypeUp(this, typeof(ScatterViewItem));

            UpdateGridPosition();
            PART_Content = (Grid) GetTemplateChild("PART_Content");
            PART_Control = (Grid) GetTemplateChild("PART_Control");
            sbSettings = (SurfaceButton) GetTemplateChild("sbSettings");
            sbResize   = (SurfaceButton) GetTemplateChild("sbResize");
            sbSettings.Click += sbSettings_Click;
            //InitResize();
            if (PART_Content == null) return;
            
            var cc = new ContentControl();
            if (Item != null && Item.ViewModel != null)
            {
                var b = ViewLocator.LocateForModel(Item.ViewModel, null, null) as FrameworkElement;
                if (b == null) return;
                b.HorizontalAlignment = HorizontalAlignment.Stretch;
                b.VerticalAlignment = VerticalAlignment.Stretch;
                ViewModelBinder.Bind(Item.ViewModel, b, null);
                cc.Content = b;
            }
            PART_Content.Children.Add(cc);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            if (false)
            {
                CultureAndRegionInfoBuilder cib = new CultureAndRegionInfoBuilder("und", CultureAndRegionModifiers.None);
                CultureInfo ci = new CultureInfo("en-US");
                cib.LoadDataFromCultureInfo(ci);
                RegionInfo ri = new RegionInfo("US");
                cib.LoadDataFromRegionInfo(ri);
                cib.Register();
            }

            InitializeComponent();
            // Add handlers for window availability events
            AddWindowAvailabilityHandlers();
            Console.WriteLine(Language);
            //add buttons
            for (int i = 0; i < 5; i++)
            {
                SurfaceButton sb = new SurfaceButton();
                sb.Content = "test" + i + ".xps";
                docContainer.Items.Add(sb);
                sb.AddHandler(SurfaceButton.ClickEvent, new RoutedEventHandler(OnButtonClick));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// UI-Erstellung sowit unabhängig von Anzahl Menüeinträgen.
        /// </summary>
        private void InitializeBaseComponents()
        {
            this.Width  = _controlWidth;
            this.Height = _optionsAmount * 50;
            MainGrid    = new Grid();
            MainGrid.ColumnDefinitions.Add(new ColumnDefinition());
            MainGrid.ColumnDefinitions.Add(new ColumnDefinition());
            MainGrid.ColumnDefinitions[1].Width = new GridLength(155);

            MenuButton                 = new SurfaceButton();
            MenuButton.Height          = _menuButtonHeight;
            MenuButton.BorderThickness = new Thickness(0);
            MenuButton.Margin          = new Thickness(0);
            MenuButton.Padding         = new Thickness(0);
            Grid.SetColumn(MenuButton, 0);
            MainGrid.Children.Add(MenuButton);

            MenuText                            = new TextBox();
            MenuText.Text                       = "Menu >>";
            MenuText.FontSize                   = 12;
            MenuText.HorizontalAlignment        = HorizontalAlignment.Center;
            MenuText.VerticalAlignment          = VerticalAlignment.Center;
            MenuText.HorizontalContentAlignment = HorizontalAlignment.Center;
            MenuText.VerticalContentAlignment   = VerticalAlignment.Center;
            MenuText.Background                 = ((LinearGradientBrush)FindResource("ListBoxItem_MenuBrush"));
            MenuText.Height                     = _menuButtonHeight;
            MenuText.Width                      = _menuButtonWidth;
            MenuText.BorderThickness            = new Thickness(0);
            MenuText.Padding                    = new Thickness(1, 1, 5, 5);
            MenuText.Style                      = (Style)FindResource("TextBox_SimpleBlack");
            MenuButton.Content                  = MenuText;

            OptionsGrid = new Grid();
            OptionsGrid.VerticalAlignment = VerticalAlignment.Center;
            OptionsGrid.Width             = 155;
            OptionsGrid.Visibility        = System.Windows.Visibility.Hidden;
            Grid.SetColumn(OptionsGrid, 1);
            MainGrid.Children.Add(OptionsGrid);

            this.Content = MainGrid;

            _moveStartPosition = new Point(0, 0);

            _touchLine    = new Line();
            _touchLine.X1 = 0;
            _touchLine.Y1 = 0;
            _touchLine.X2 = 1;
            _touchLine.Y2 = 0;
            _touchLine.StrokeThickness       = 3;
            _touchLine.StrokeStartLineCap    = PenLineCap.Round;
            _touchLine.StrokeEndLineCap      = PenLineCap.Round;
            _touchLine.Stroke                = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
            _touchLine.Visibility            = System.Windows.Visibility.Hidden;
            _touchLine.RenderTransformOrigin = new Point(0, 0.5);
            Grid.SetColumnSpan(_touchLine, 2);
            MainGrid.Children.Add(_touchLine);
        }
Exemplo n.º 6
0
        public WebsiteLink(string url, string title, BitmapImage img)
        {
            Url = url;

            Grid grid = new Grid()
            {
                Background = new SolidColorBrush(Color.FromArgb(200, 50, 50, 50))
            };
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            base.Content = grid;

            if (title != null)
            {
                TextBlock text = new TextBlock()
                {
                    Text = title,
                    Foreground = new SolidColorBrush(Colors.White),
                    FontSize = 16,
                    Margin = new Thickness(12, 0, 12, 12)
                };
                Grid.SetRow(text, 1);
                grid.Children.Add(text);
            }

            Grid imgContainer = new Grid();
            Grid.SetRow(imgContainer, 0);
            grid.Children.Add(imgContainer);

            SurfaceButton button = new SurfaceButton()
            {
                Padding = new Thickness(0),
                Content = new Image()
                {
                    Source = img,
                    Margin = new Thickness(12)
                }
            };
            button.Click += new RoutedEventHandler(button_Click);
            imgContainer.Children.Add(button);

            _help = new Grid()
            {
                Background = new SolidColorBrush(Colors.Black),
                Opacity = 0,
                Visibility = System.Windows.Visibility.Collapsed
            };
            imgContainer.Children.Add(_help);

            _help.Children.Add(new TextBlock()
            {
                Text = "Drop the page on your web browser to open the link.",
                TextWrapping = TextWrapping.Wrap,
                Foreground = new SolidColorBrush(Colors.White),
                Margin = new Thickness(24)
            });
        }
Exemplo n.º 7
0
 private void AddSVIsToScatterView(ScatterViewItem[] svis)
 {
     foreach (ScatterViewItem item in svis)
     {
         SurfaceButton button = (SurfaceButton)item.FindName(item.Name.Replace("_SVI", "_FLIPBUTTON"));
         button.Click += new RoutedEventHandler(FlipImage);
         scatterView1.Items.Add(item);
     }
 }
Exemplo n.º 8
0
        private void LoadFloor()
        {
            ObservableCollection <SurfaceButton> ButList = new ObservableCollection <SurfaceButton>();

            Uri         uri  = new Uri(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\icon_floor01.png"), UriKind.RelativeOrAbsolute);
            BitmapImage bimg = new BitmapImage(uri);

            SplitListHelper.ClearList();
            SplitListHelper.SplitDic(floorAlllist, step);
            List <int> floorlist = SplitListHelper.GetChildList(CurrentPage);

            if (SplitListHelper.SplitList.Count > 1)
            {
                AddFloorButton(ButList, "<<", bimg);
            }
            for (int i = 0; i < floorlist.Count; i++)
            {
                floor = floorlist[0];
                string ContentValue = "";

                if (Convert.ToInt32(floorlist[i].ToString().Trim()) > 0)
                {
                    ContentValue = @"F" + floorlist[i].ToString().Trim();
                }
                else if (Convert.ToInt32(floorlist[i].ToString().Trim()) < 0)
                {
                    ContentValue = @"B" + Math.Abs(Convert.ToInt32(floorlist[i].ToString()));
                }
                else
                {
                    ContentValue = @"G";
                }
                AddFloorButton(ButList, ContentValue, bimg);
            }
            if (SplitListHelper.SplitList.Count > 1)
            {
                AddFloorButton(ButList, ">>", bimg);
            }
            this.lv_Floor.ItemsSource = ButList;
            LoadCompany();

            SurfaceButton but = null;

            if (SplitListHelper.SplitList.Count > 1)
            {
                but = ButList.ToList()[1] as SurfaceButton;
            }
            else
            {
                but = ButList.ToList()[0] as SurfaceButton;
            }

            dib_Click(but, new RoutedEventArgs());
        }
Exemplo n.º 9
0
        /// <summary>
        /// Change the ellipse color based on the clicked SurfaceButton. It also change the InkCanvas color too.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onClick(object sender, RoutedEventArgs e)
        {
            //Get the clicked SurfaceButton
            SurfaceButton s = e.OriginalSource as SurfaceButton;


            //Set canvas color
            SolidColorBrush brush = s.Background as SolidColorBrush;
            // SurfaceWindow._currentColor = brush.Color;
            //SurfaceWindow.GetInstance().InkCanvas.DefaultDrawingAttributes.Color = brush.Color;
        }
Exemplo n.º 10
0
        public HomeScreen(SurfaceWindow1 parentWindow)
            : base(parentWindow)
        {
            InitializeComponent();

            touch1 = null;
            touch2 = null;
            initialDist = Double.MaxValue;
            triggered = false;
            down = false;
            newImage = null;
        }
Exemplo n.º 11
0
        void dib_Click(object sender, RoutedEventArgs e)
        {
            Uri           uri           = new Uri(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\icon_floor.png"), UriKind.RelativeOrAbsolute);
            Uri           uriClick      = new Uri(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\icon_floor01.png"), UriKind.RelativeOrAbsolute);
            BitmapImage   bimg          = new BitmapImage(uri);
            BitmapImage   bimgCilck     = new BitmapImage(uriClick);
            SurfaceButton surfacebutton = sender as SurfaceButton;
            ObservableCollection <SurfaceButton> ButList = this.lv_Floor.ItemsSource as ObservableCollection <SurfaceButton>;

            if (ButList != null)
            {
                foreach (SurfaceButton item in ButList)
                {
                    item.Background = new ImageBrush(bimg);
                    //item.Background = new SolidColorBrush(Colors.Green);
                }
            }
            surfacebutton.Background = new ImageBrush(bimgCilck);
            //Label lb = surfacebuttton.Content as Label;
            char str = surfacebutton.Content.ToString()[0];

            switch (str)
            {
            case 'G':
                floor = 0;
                break;

            case '<':

                //////////////////////////////////////////////////////////////////////////
                //增加前翻页和后翻页的逻辑判断
                //////////////////////////////////////////////////////////////////////////
                CurrentPage = (CurrentPage - 1) < 0 ? 0 : (CurrentPage - 1);
                LoadFloor();
                break;

            case '>':
                CurrentPage = (CurrentPage + 1) >= SplitListHelper.SplitList.Count ? SplitListHelper.SplitList.Count - 1 : (CurrentPage + 1);
                LoadFloor();
                break;

            default:
                //Label lb = surfacebuttton.Content as Label;
                floor = Int32.Parse(surfacebutton.Content.ToString().Remove(0, 1));
                if (str == 'B')
                {
                    floor *= -1;
                }
                break;
            }
            LoadCompany();
        }
Exemplo n.º 12
0
        private void deleteFriendButton_Click(object sender, RoutedEventArgs e)
        {
            /*
             * Get friend name
             */
            SurfaceButton b = sender as SurfaceButton;
            String        s = b.DataContext as String;

            /*
             * Call datacontext function.
             */
            ((ViewModel.VMFriend)(DataContext)).removeFriend(s);
        }
Exemplo n.º 13
0
        public void AddLayerButton_ClickTest()
        {
            MapLayersMangerPanel_Accessor target = new MapLayersMangerPanel_Accessor();
            SurfaceButton sender = new SurfaceButton();
            RoutedEventArgs e = null;

            int initialNumLayers = MapLayersManager.Instance.MapLayers.Count;

            target.DeleteLayerButton_Click(sender, e);

            // Check that the # of layers in the MapLayerMgr is less by 1
            int finalNumLayers = MapLayersManager.Instance.MapLayers.Count;
            Assert.AreEqual(initialNumLayers + 1, finalNumLayers);
        }
Exemplo n.º 14
0
        private void OnButtonClick(object sender, RoutedEventArgs e)
        {
            SurfaceButton  b         = sender as SurfaceButton;
            DocumentViewer docViewer = new DocumentViewer();

            docViewer.Margin   = new Thickness(20);
            docViewer.Language = Language;
            XpsDocument doc = new XpsDocument(@"D:\Flip Project 2.0\preparation\ProjectFlipXPSPrototype\SurfaceDarstellung\xpss\" + b.Content, FileAccess.Read);

            docViewer.Document = doc.GetFixedDocumentSequence();
            docViewer.FitToWidth();
            doc.Close();
            docContainer.Items.Add(docViewer);
            docContainer.Items.Remove(b);
        }
        /// <summary>
        /// ANimiert Zurückgleiten SafeSelect-Feld in Ausgangsposition.
        /// </summary>
        /// <param name="button"></param>
        private void ResetButton(SurfaceButton button)
        {
            ThicknessAnimation moveAnimation = new ThicknessAnimation();

            moveAnimation.Duration     = TimeSpan.FromSeconds(0.1);
            moveAnimation.FillBehavior = FillBehavior.Stop;
            moveAnimation.To           = new Thickness(226, button.Margin.Top, button.Margin.Right, button.Margin.Bottom);

            Storyboard resetStoryboard = new Storyboard();

            resetStoryboard.Children.Add(moveAnimation);
            Storyboard.SetTargetName(moveAnimation, button.Name);
            Storyboard.SetTargetProperty(moveAnimation, new PropertyPath(TextBox.MarginProperty));
            resetStoryboard.Completed += new EventHandler(resetStoryboard_Completed);

            resetStoryboard.Begin(this);
        }
Exemplo n.º 16
0
        public override void OnApplyTemplate()
        {
            if (painter != null)
                Strokes = painter.Strokes;

            if (text != null)
                Name = text.Text;

            if (GetTemplateChild("btnReset") != null)
            {
                reset = GetTemplateChild("btnReset") as SurfaceButton;
                reset.Click += new RoutedEventHandler(btnReset_Click);
            }

            if (GetTemplateChild("txtName") != null)
            {
                text = GetTemplateChild("txtName") as SurfaceTextBox;
                text.TextChanged += new TextChangedEventHandler(text_TextChanged);
                text.Text = Name;
            }

            if (GetTemplateChild("lblName") != null)
            {
                label = GetTemplateChild("lblName") as Label;
                label.Content = Name;
            }

            if (GetTemplateChild("Painter") != null)
            {
                painter = GetTemplateChild("Painter") as SurfaceInkCanvas;
                // Set up the DrawingAttributes for the pen.
                var inkDA = new DrawingAttributes();
                inkDA.Color = Colors.Black;
                inkDA.Height = 1;
                inkDA.Width = 1;
                inkDA.FitToCurve = false;
                painter.UsesTouchShape = false;

                painter.DefaultDrawingAttributes = inkDA;
                if(Strokes != null)
                    painter.Strokes = Strokes;
            }  
            base.OnApplyTemplate();
        }
Exemplo n.º 17
0
        private void GenerateButtons()
        {
            // use tag on button to know which year it belongs to OR combine the maps with an extra field
            // OR change XML to have year as a attribute
            //foreach (string course in firstyear)
            foreach (var pair in CourseItems)
            {
                SurfaceButton myButton = new SurfaceButton();

                myButton.Content = pair.Key; //name
                myButton.Click += CourseButton_Click;
                myButton.Tag = pair.Value[1];
                myButton.Style = (Style)Resources["Tile"];

                myButton.Background = new SolidColorBrush(Color.FromArgb(0xff, 0x9a, 0x77, 0xcf));
                myButton.Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff));
                myButton.BorderThickness = new Thickness(0);
                myButton.FontSize = 24;
                myButton.Margin = new Thickness(2);
                myButton.Padding = new Thickness(16);
                myButton.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
                myButton.VerticalContentAlignment = System.Windows.VerticalAlignment.Bottom;

                switch (pair.Value[1])
                {
                    case "1":
                        Year1Panel.Children.Add(myButton);
                        break;

                    case "2":
                        Year2Panel.Children.Add(myButton);
                        break;

                    case "3":
                        Year3Panel.Children.Add(myButton);
                        break;

                    case "4":
                        Year4Panel.Children.Add(myButton);
                        break;

                }
            }
        }
        /// <summary>
        /// Toggles the edit mode of a SurfaceInkCanvas between EraseByPoint and Ink.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="args">The arguments for the event.</param>
        private void EditModeClicked(object sender, RoutedEventArgs args)
        {
            SurfaceButton button = (SurfaceButton)sender;

            if (DrawingPadCanvas.EditingMode == SurfaceInkEditingMode.Ink)
            {
                DrawingPadCanvas.EditingMode = SurfaceInkEditingMode.EraseByPoint;

                // Load the new button image
                button.Content = LoadImageFromPath("Resources\\Erase.png");
            }
            else
            {
                DrawingPadCanvas.EditingMode = SurfaceInkEditingMode.Ink;

                // Load the new button image
                button.Content = LoadImageFromPath("Resources\\Draw.png");
            }
        }
        /// <summary>
        /// Event wird aufgerufen wenn TouchUp auf SafeSelect.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Eventparameter</param>
        private void OptionTouchUp(object sender, TouchEventArgs e)
        {
            // If this contact is the one that was remembered
            if (e.TouchDevice == OptionControlTouchDevice)
            {
                // Forget about this contact.
                OptionControlTouchDevice = null;

                SurfaceButton pressedButton = (SurfaceButton)sender;

                var bc = new BrushConverter();
                DoNothingText.Foreground     = new SolidColorBrush(Colors.White);
                PausePlayText.Foreground     = new SolidColorBrush(Colors.White);
                StopText.Foreground          = new SolidColorBrush(Colors.White);
                KillText.Foreground          = new SolidColorBrush(Colors.White);
                ChosenMeasureText.Foreground = Brushes.White;
                ConfirmRectangle.Fill        = (Brush)bc.ConvertFrom("#FFE2E2E2");

                if (pressedButton.Margin.Left >= 100)
                {
                    pressedButton.Margin = new Thickness(21, pressedButton.Margin.Top, pressedButton.Margin.Right, pressedButton.Margin.Bottom);
                    // pass event to SurfaceWindow1.xaml.cs
                    if (CurrentNavigation == 0)
                    {
                        ControlInstanceChosenOption(this, new OptionChosenEventArgs(_instance, false, _chosenControl));
                    }
                    else
                    {
                        ControlInstanceChosenOption(this, new OptionChosenEventArgs(_instance, true, _chosenControl));
                    }
                    BindInstance(null); //, null
                }
                else
                {
                    // Reset Button
                    ResetButton(pressedButton);
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            _smallImage = GetTemplateChild("PART_SmallImage") as SmallImage;
            _smallNews  = GetTemplateChild("PART_SmallNews") as SmallNews;
            _smallTweet = GetTemplateChild("PART_SmallTweet") as SmallTweet;
            _banBtn     = GetTemplateChild("PART_BanBtn") as SurfaceButton;
            _deleteBtn  = GetTemplateChild("PART_DeleteBtn") as SurfaceButton;

            _banBtn.Click    += AdminBtn_Click;
            _deleteBtn.Click += AdminBtn_Click;

            _breaking = (Template.Resources["Breaking"] as Storyboard).Clone();

            _parentProxy = this.FindVisualParent <ItemProxy>();

            if (_parentProxy != null)
            {
                _smallImage.Image.ImageLoaded += (sender, e) => _parentProxy.IsEnabled = true;
            }

            base.OnApplyTemplate();
        }
Exemplo n.º 21
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            _smallImage = GetTemplateChild("PART_SmallImage") as SmallImage;
            _smallNews = GetTemplateChild("PART_SmallNews") as SmallNews;
            _smallTweet = GetTemplateChild("PART_SmallTweet") as SmallTweet;
            _banBtn = GetTemplateChild("PART_BanBtn") as SurfaceButton;
            _deleteBtn = GetTemplateChild("PART_DeleteBtn") as SurfaceButton;

            _banBtn.Click += AdminBtn_Click;
            _deleteBtn.Click += AdminBtn_Click;

            _breaking = (Template.Resources["Breaking"] as Storyboard).Clone();

            _parentProxy = this.FindVisualParent<ItemProxy>();

            if (_parentProxy != null)
            {
                _smallImage.Image.ImageLoaded += (sender, e) => _parentProxy.IsEnabled = true;
            }

            base.OnApplyTemplate();
        }
Exemplo n.º 22
0
        public void addRotateButtons()
        {
            string packUri = "pack://application:,,,/Resources/rotateLeft.png";
            Image  img     = new Image();

            img.Source                     = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;
            leftButton                     = new SurfaceButton();
            leftButton.Content             = img;
            leftButton.Click              += new RoutedEventHandler(rotateLeft_Click);
            leftButton.Background          = System.Windows.Media.Brushes.Transparent;
            leftButton.BorderBrush         = System.Windows.Media.Brushes.Transparent;
            leftButton.Padding             = new Thickness(0);
            leftButton.Margin              = new Thickness(3, 0, 0, 0);
            leftButton.VerticalAlignment   = VerticalAlignment.Center;
            leftButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            leftButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            MainGrid.Children.Add(leftButton);
            leftButton.SetValue(Grid.ColumnProperty, 0);
            leftButton.SetValue(Grid.RowProperty, 1);

            string packUri2 = "pack://application:,,,/Resources/rotateRight.png";
            Image  img2     = new Image();

            img2.Source                     = new ImageSourceConverter().ConvertFromString(packUri2) as ImageSource;
            rightButton                     = new SurfaceButton();
            rightButton.Content             = img2;
            rightButton.Click              += new RoutedEventHandler(rotateRight_Click);
            rightButton.Background          = System.Windows.Media.Brushes.Transparent;
            rightButton.BorderBrush         = System.Windows.Media.Brushes.Transparent;
            rightButton.Padding             = new Thickness(0);
            rightButton.Margin              = new Thickness(0, 0, 3, 0);
            rightButton.VerticalAlignment   = VerticalAlignment.Center;
            rightButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            rightButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            MainGrid.Children.Add(rightButton);
            rightButton.SetValue(Grid.ColumnProperty, 2);
            rightButton.SetValue(Grid.RowProperty, 1);
        }
Exemplo n.º 23
0
        public void AddFloorButton(ObservableCollection <SurfaceButton> ButList, string ContentValue, BitmapImage bimg)
        {
            SurfaceButton dib = new SurfaceButton();

            dib.Background = new ImageBrush(bimg);
            //dib.Background = new SolidColorBrush(Colors.Green);
            dib.Foreground = Brushes.White;
            dib.FontSize   = 20;
            dib.Height     = 50;
            dib.Width      = 50;
            //Label lb = new Label();
            //lb.Background = new SolidColorBrush(Colors.Red);
            //lb.Content = ContentValue;
            dib.HorizontalContentAlignment = HorizontalAlignment.Center;
            dib.VerticalContentAlignment   = VerticalAlignment.Center;
            dib.HorizontalAlignment        = HorizontalAlignment.Center;
            dib.VerticalAlignment          = VerticalAlignment.Center;
            dib.Content   = ContentValue;
            dib.IsTabStop = false;

            dib.Click += new RoutedEventHandler(dib_Click);
            ButList.Add(dib);
        }
Exemplo n.º 24
0
        /*
         * PREPARE EVENTS PANEL TO BE USED WITH A PROTOTYPE ELEMENT
         */
        public void SetupEventsPanel(PrototypeElement instance = null)
        {
            this.TriggersGrid.IsEnabled = (instance != null);

            this.TriggersGrid.Items.Clear();

            ScatterViewItem svi = asg.Container.ItemContainerGenerator.ContainerFromItem(this) as ScatterViewItem;

            if (svi == null)
                return;

            const string behaviorLabelFormatBase = "Navigate, Page {0}";

            LookForNewGestures();

            foreach (var item in asg.ActiveSessionManager.CommonGestureManager.GestureList)
            {
                //SurfaceListBoxItem listItem = new SurfaceListBoxItem();

                DockPanel panel = new DockPanel();

                Border borderLeft = new Border { BorderBrush = Brushes.Gray, BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(5), Background = Brushes.White };
                Label gestureLabel = new Label { Content = item.DisplayName, Width = svi.Width /4, FontSize=20 };
                borderLeft.Child = gestureLabel;
                panel.Children.Add(borderLeft);

                Border borderRight = new Border { BorderBrush = Brushes.Gray, BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(5), Background = Brushes.White };
                DockPanel rightDockPanel = new DockPanel { LastChildFill = true };
                borderRight.Child = rightDockPanel;

                String behaviorLabelText = String.Empty;
                if (instance != null)
                {
                    if (instance.GestureTargetPageMap.ContainsKey(item.Identifier) && asg.ActiveSessionManager.CurrentProject.PageDictionary.ContainsKey(instance.GestureTargetPageMap[item.Identifier]))
                        behaviorLabelText = String.Format(behaviorLabelFormatBase, asg.ActiveSessionManager.CurrentProject.PageDictionary[instance.GestureTargetPageMap[item.Identifier]].PageNumber);
                }
                Label behaviorLabel = new Label { Content = behaviorLabelText, Width = svi.Width/2.2, FontSize=20 };

                SurfaceButton setValueButton = new SurfaceButton
                {
                    Content = "+",
                    FontSize=25,
                    FontWeight = FontWeights.Bold,
                    Width = 40,
                    Height=40,
                    Foreground = new SolidColorBrush(Colors.White),
                    Background = new SolidColorBrush((Color)System.Windows.Media.ColorConverter.ConvertFromString("#282828")),
                    BorderThickness = new Thickness(0, 0, 0, 0),

                    Tag = item

                };

                SurfaceButton removeValueButton = new SurfaceButton
                {
                    Content = "-",
                    FontSize = 25,
                    Height=40,
                    Foreground = new SolidColorBrush(Colors.White),
                    FontWeight = FontWeights.Bold,

                    Width = 45,
                    Background = new SolidColorBrush((Color)System.Windows.Media.ColorConverter.ConvertFromString("#282828")),
                    BorderThickness = new Thickness(0, 0, 0, 0),

                    Tag = item

                };

                setValueButton.Click += new RoutedEventHandler(delegate(object sender, RoutedEventArgs args)
                {
                    if (instance == null)
                        return;

                    if (asg.Container.Items.Contains(choose))
                    {
                        asg.Container.Items.Remove(choose);
                    }

                    String selectedGestureId = (setValueButton.Tag as Gesture).Identifier;
                    choose = new NavigationPageDialog(instance, asg.ActiveSessionManager, selectedGestureId, behaviorLabel);
                    asg.Container.Items.Add(choose);
                    ScatterViewItem newItem = asg.Container.ItemContainerGenerator.ContainerFromItem(choose) as ScatterViewItem;
                    newItem.Orientation = 0;
                    newItem.Height = asg.Height / 2;
                    newItem.Width = asg.Width / 1.3;

                    newItem.Center = asg.CanvasItem.ActualCenter;

                });

                removeValueButton.Click += new RoutedEventHandler(delegate(object sender, RoutedEventArgs args)
                {

                    String selectedGestureId = (setValueButton.Tag as Gesture).Identifier;

                    if (instance.GestureTargetPageMap.ContainsKey(selectedGestureId))
                    {
                        instance.GestureTargetPageMap.Remove(selectedGestureId);
                        behaviorLabel.Content = "";
                    }
                });
                DockPanel.SetDock(setValueButton, Dock.Right);
                DockPanel.SetDock(removeValueButton, Dock.Right);
                rightDockPanel.Children.Add(removeValueButton);
                rightDockPanel.Children.Add(setValueButton);
                rightDockPanel.Children.Add(behaviorLabel);
                panel.Children.Add(borderRight);
                this.TriggersGrid.Items.Add(panel);
            }
        }
Exemplo n.º 25
0
 /// <summary>
 /// adds event handler to all children
 /// </summary>
 /// <param name="target"></param>
 public virtual bool ContainsButton(SurfaceButton sender)
 {
     return children.Get(sender) !=null ;
 }
Exemplo n.º 26
0
 /// <summary>
 /// adds event handler to all children
 /// </summary>
 /// <param name="target"></param>
 public virtual string FileToOpen(SurfaceButton sender)
 {
     return children.Get(sender).SubFile;
 }
Exemplo n.º 27
0
        private void load()
        {
            RelativePositionAxes = Axes.X;
            RelativeSizeAxes     = Axes.Both;
            X = -1;

            InternalChildren = new Drawable[]
            {
                new InvitationsUpdater(),
                hideButton = new SurfaceButton
                {
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    BackgroundColour = ColourInfo.GradientHorizontal(Colour4.Black.Opacity(0.6f).ToLinear(), Colour4.Black.Opacity(0f).ToLinear()),
                    Width            = 0.2f,
                    Action           = Hide,
                },
                new Box
                {
                    Anchor           = Anchor.TopLeft,
                    Origin           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Colour4.Black.Opacity(0.6f).ToLinear(),
                },
                new Container
                {
                    RelativePositionAxes = Axes.Both,
                    RelativeSizeAxes     = Axes.Both,
                    Width           = .8f,
                    BorderColour    = Colour4.Black,
                    BorderThickness = 3.5f,
                    Masking         = true,
                    Children        = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Colour4(106, 100, 104, 255)
                        },
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            RowDimensions    = new[]
                            {
                                new Dimension(GridSizeMode.Relative, .9f),
                                new Dimension()
                            },
                            ColumnDimensions = new[]
                            {
                                new Dimension()
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Child            = new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Direction        = FillDirection.Vertical,
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Height           = .3f,
                                                    BorderColour     = Colour4.Black,
                                                    BorderThickness  = 3.5f,
                                                    Masking          = true,
                                                    Padding          = new MarginPadding {
                                                        Top = 80, Left = 20, Right = 20
                                                    },
                                                    Child = new SurfaceButton
                                                    {
                                                        Action   = profileScreen,
                                                        Children = new Drawable[]
                                                        {
                                                            new FillFlowContainer
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                Direction        = FillDirection.Vertical,
                                                                Padding          = new MarginPadding()
                                                                {
                                                                    Bottom = 40
                                                                },
                                                                Children = new Drawable[]
                                                                {
                                                                    new CircularContainer
                                                                    {
                                                                        Anchor          = Anchor.Centre,
                                                                        Origin          = Anchor.Centre,
                                                                        BorderColour    = Colour4.Black,
                                                                        BorderThickness = 3.5f,
                                                                        Masking         = true,
                                                                        Size            = new Vector2(300, 300),
                                                                        Child           = userImage = new Sprite
                                                                        {
                                                                            Anchor           = Anchor.Centre,
                                                                            Origin           = Anchor.Centre,
                                                                            RelativeSizeAxes = Axes.Both,
                                                                            Texture          = textures.Get("Images/gtg"),
                                                                        },
                                                                    },
                                                                    username = new SpriteText
                                                                    {
                                                                        Anchor = Anchor.Centre,
                                                                        Origin = Anchor.Centre,
                                                                        Text   = "Guest",
                                                                        Font   = new FontUsage(size: 80)
                                                                    },
                                                                },
                                                            },
                                                        },
                                                    },
                                                },
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Height           = .15f,
                                                    BorderColour     = Colour4.Black,
                                                    BorderThickness  = 3.5f,
                                                    Masking          = true,
                                                    Padding          = new MarginPadding(20),
                                                    Child            = new SurfaceButton
                                                    {
                                                        Action   = () => invitesScreen(),
                                                        Children = new Drawable[]
                                                        {
                                                            new FillFlowContainer
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                Spacing          = new Vector2(30),
                                                                Children         = new Drawable[]
                                                                {
                                                                    numberContainer = new Container
                                                                    {
                                                                        Anchor = Anchor.CentreRight,
                                                                        Origin = Anchor.CentreRight,

                                                                        Children = new Drawable[]
                                                                        {
                                                                            new Box
                                                                            {
                                                                                RelativeSizeAxes = Axes.Both,
                                                                                Colour           = Colour4.LightBlue,
                                                                            },
                                                                            invitationsNumber = new SpriteText
                                                                            {
                                                                                Anchor = Anchor.Centre,
                                                                                Origin = Anchor.Centre,
                                                                                Font   = new FontUsage(size: 70)
                                                                            },
                                                                        }
                                                                    },
                                                                    new SpriteText
                                                                    {
                                                                        Anchor = Anchor.CentreRight,
                                                                        Origin = Anchor.CentreRight,
                                                                        Text   = "Invitaciones",
                                                                        Font   = new FontUsage(size: 80)
                                                                    },
                                                                }
                                                            }
                                                        },
                                                    }
                                                },
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Height           = .15f,
                                                    BorderColour     = Colour4.Black,
                                                    BorderThickness  = 3.5f,
                                                    Masking          = true,
                                                    Padding          = new MarginPadding(20),
                                                    Child            = new SurfaceButton
                                                    {
                                                        Action   = logout,
                                                        Children = new Drawable[]
                                                        {
                                                            new SpriteText
                                                            {
                                                                Anchor = Anchor.CentreRight,
                                                                Origin = Anchor.CentreRight,
                                                                Text   = "Cerrar Sesión",
                                                                Font   = new FontUsage(size: 80)
                                                            },
                                                        },
                                                    }
                                                },
                                            },
                                        },
                                    },
                                },
                                new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        BorderColour     = Colour4.Black,
                                        BorderThickness  = 3.5f,
                                        Masking          = true,
                                        Padding          = new MarginPadding(20),
                                        Children         = new Drawable[]
                                        {
                                            new SpriteText
                                            {
                                                Anchor = Anchor.CentreRight,
                                                Origin = Anchor.CentreRight,
                                                Text   = "GamesToGo",
                                                Font   = new FontUsage(size: 80)
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                profileOverlay,
                invitationsOverlay
            };
            invitations.BindTo(game.Invitations);
            invitations.BindCollectionChanged((_, __) => changeInvitationsNumber());
            localUser.BindTo(api.LocalUser);
            localUser.BindValueChanged(_ => changeUserData(), true);
        }
Exemplo n.º 28
0
        //Reads the relevant xml file and loads panel with an image and caption for each item
        //The CCF logo is used as a placeholder if necessary.
        private void showNewsOrEvents(String content, StackPanel panel)
        {
            //read in news or events information
            XmlDocument xml = new XmlDocument();
            xml.Load("Resources/xml/" + content + ".xml");

            foreach (XmlNode node in xml.SelectNodes("//" + content + "/item"))
            {
                String id = node.SelectSingleNode("id/text()").Value;
                String title = node.SelectSingleNode("title/text()").Value;
                XmlNode imageNode = node.SelectSingleNode("photos/img");
                Uri imgUri = new Uri("pack://application:,,,/Resources/images/Common/CCF-logo2_200.png", UriKind.Absolute);

                //use the image if there is one. Otherwise use the CCF logo.
                if (imageNode != null)
                {
                    imgUri = new Uri(Directory.GetCurrentDirectory() + "/" + imageNode.Attributes["src"].Value, UriKind.Absolute);
                }

                //put the image and caption in a button (using a canvas)
                BitmapImage bi = new BitmapImage(imgUri);
                SurfaceButton s = new SurfaceButton();
                Canvas c = new Canvas();

                //canvas height and width must be set :(
                c.Height = panel.Height - 10;
                c.Width = c.Height / bi.PixelHeight * bi.PixelWidth;
                c.Children.Add(new Image() { Source = bi, Height=c.Height });

                //label has white text on a semi-transparent dark background
                Label l = new Label() { Content = title, Width = c.Width };
                l.Foreground = new SolidColorBrush(Colors.White);
                l.Background = new SolidColorBrush(Colors.Black) { Opacity=0.5 };
                Canvas.SetBottom(l, 0);
                c.Children.Add(l);

                s.Name = id;
                s.Padding = new Thickness(0);
                s.Margin = new Thickness(4);
                s.Content = c;

                if (content == "News")
                {
                    s.Click += News_Click;
                }
                else if (content == "Events")
                {
                    s.Click += Events_Click;
                }
                panel.Children.Add(s);
            }
        }
Exemplo n.º 29
0
        public void OpenGroupingOperationMenu(DataSet ds, SurfaceButton b)
        {

            var menu = GetMenu(b);
            foreach (var a in Enum.GetValues(typeof(GroupingOperations)))
            {
                var mi = menu.AddMenuItem(a.ToString());
                mi.Click += (e, s) =>
                {
                    SelectedDataSet.GroupingOperation = (GroupingOperations)a;
                    UpdateDataSet(SelectedDataSet);
                    menu.Close();
                };
            }
            AppState.Popups.Add(menu);
        }
Exemplo n.º 30
0
        public void OpenDataSetMenu(DataSet ds, SurfaceButton b)
        {
            var menu = new MenuPopupViewModel();
            menu.RelativeElement = b;
            menu.RelativePosition = new Point(0, 0);
            menu.TimeOut = new TimeSpan(0, 0, 0, 5);
            //menu.Point = _view.CreateLayer.TranslatePoint(new Point(0,0),Application.Current.MainWindow);
            menu.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            //menu.DisplayProperty = "ServiceName";
            menu.AutoClose = true;
            var miRemove = menu.AddMenuItem("Remove");
            miRemove.Click += (e, s) =>
                {
                    DataSets.Remove(ds);
                    menu.Close();
                };

            var miFit = menu.AddMenuItem("Fit");
            miFit.Click += (e, s) =>
            {
                FitDataSet(ds);
                menu.Close();
            };

            var miDuplicate = menu.AddMenuItem("Duplicate");
            miDuplicate.Click += (e, s) =>
                {
                    DataSet d = ds.Clone() as DataSet;
                    DataSets.Add(d);
                    menu.Close();
                };

            var miEdit = menu.AddMenuItem("Edit");
            miEdit.Click += (e, s) =>
                {
                    SelectedDataSet = ds;
                    menu.Close();
                    EditDataSet = true;
                };


            var miDraw = menu.AddMenuItem("Draw");
            miDraw.Click += (e, s) =>
            {
                SelectedDataSet = ds;
                menu.Close();
                if (DrawDataSet == false)
                {
                    DrawDataSet = true;
                    // Subscribe to the mouse down event on the line series
                    _view.PreviewMouseLeftButtonDown += _view_PreviewMouseLeftButtonDown;
                    _view.PreviewMouseMove += _view_PreviewMouseMove;
                    _view.PreviewMouseLeftButtonUp += _view_PreviewMouseLeftButtonUp;
                    

                }
                else
                {
                    DrawDataSet = false;
                }
            };
            AppState.Popups.Add(menu);
        }
Exemplo n.º 31
0
 /// <summary>
 /// returns  the square that exists in children
 /// or in any of its sub nodes' children
 /// that contains the button sqr
 /// </summary>
 /// <param name="sqr">button used to find a square</param>
 /// <returns></returns>
 public override Square Get(SurfaceButton sqr)
 {
     if (children.Get(sqr) == null)
     {
         return child.Get(sqr);
     }
     return children.Get(sqr);
 }
Exemplo n.º 32
0
 /// <summary>
 /// Finds the Square that contains sender
 /// then returns the file from that square
 /// </summary>
 /// <param name="sender"></param>
 /// <returns>a string path to a file containing information for another treeMenu</returns>
 public override string FileToOpen(SurfaceButton sender)
 {
     if (child != null && child.ContainsButton(sender))
     {
         return child.FileToOpen(sender);
     }
     else
     {
         return children.Get(sender).SubFile;
     }
 }
Exemplo n.º 33
0
 /// <summary>
 /// checks children and sub menus children
 /// </summary>
 /// <param name="sender"></param>
 /// <returns>true if sender exists anywhere in the menu. false otherwise</returns>
 public override bool ContainsButton(SurfaceButton sender)
 {
     return children.Get(sender) != null || (child != null && child.ContainsButton(sender));
 }
Exemplo n.º 34
0
        /// <summary>
        /// used in the cloning process
        /// </summary>
        /// <param name="children">children that are to be cloned</param>
        /// <param name="oldCrumbs">crumbs in the other treemenu</param>
        /// <param name="ParentList">the list of menus that this new menu will be added to</param>
        private TreeMenu(SquareList children, List<SurfaceButton> oldCrumbs, List<Menu.Menu> ParentList)
            : base(children)
        {
            breadCrumbs = new List<SurfaceButton>();
            this.children = SquareList.createSquareList(children);

            Initialize();
            this.ParentList = ParentList;
            InHistory = true;
            foreach (SurfaceButton oldc in oldCrumbs)
            {
                SurfaceButton crumb = new SurfaceButton();
                crumb.Height = 0.15 * height;
                crumb.Background = oldc.Background;

                TextBlock block = new TextBlock();
                block.Text = ((TextBlock)oldc.Content).Text;
                block.FontSize = 13;

                crumb.Content = block;
                crumb.Foreground = oldc.Foreground;
                crumb.PreviewTouchUp += new EventHandler<TouchEventArgs>(RetraceToBreadCrumb);
                breadCrumbs.Add(crumb);
                canvas.Children.Add(crumb);
            }
            CreateExit();
            SizeCrumbs();
            myTimer.Tick += new EventHandler(myTimer_Tick);
            interactive = true;
            FillDrawing();
        }
 /*
  * interface-method
  */
 public void keyPressed(SurfaceButton pressedButton)
 {
     //check if arrows were pressed
     if (pressedButton.Name == "ArrowLeft")
     {
         arrowWasTyped(-1);
     }
     else if (pressedButton.Name == "ArrowRight")
     {
         arrowWasTyped(+1);
     }
     // return-Key
     else if (pressedButton.Name == "BackSpace")
     {
         backSpaceWasTyped();
     }
     //normal letter-buttons
     else
     {
         string key = "" + pressedButton.Content;
         if (pressedButton.Name == "Enter")
         {
             key = "\n";
         }
         normalKeyWasTyped(key);
     }
 }
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
        /// <summary>
        /// returns if the square related to the button sender
        /// has the explanation field filled out
        /// </summary>
        /// <param name="sender"></param>
        /// <returns></returns>
        public bool HasExplanation(SurfaceButton sender)
        {
            if (child != null && child.ContainsButton(sender))
            {
                return child.HasExplanation(sender);

            }
            else
            {
                return children.Get(sender).HasExplanation();
            }
        }
Exemplo n.º 38
0
 // Sets the passed button's width and height to be equal to size.
 private void SetButtonSize(SurfaceButton button, Double size)
 {
     button.Height = size;
     button.Width  = size;
 }
Exemplo n.º 39
0
        /// <summary>
        /// Adds A new crumb based on creator
        /// </summary>
        /// <param name="creator">created the new menu</param>
        private void CreateCrumb(Square creator)
        {
            SurfaceButton crumb = new SurfaceButton();
            crumb.Background = new SolidColorBrush(creator.BackGroundColor);
            crumb.Foreground = creator.TextBrush;

            TextBlock block =new TextBlock();
            block.Text    = creator.Name;
            block.FontSize = 13;

            crumb.Content = block;
            crumb.PreviewTouchUp += new EventHandler<TouchEventArgs>(RetraceToBreadCrumb);
            crumb.BorderThickness = new Thickness(0);
            breadCrumbs.Add(crumb);
            canvas.Children.Add(crumb);
            SizeCrumbs();
        }
Exemplo n.º 40
0
        public void OpenSettingsMenu(SurfaceButton b)
        {
            var m = GetMenu(b);
            //var fit = m.AddMenuItem("Fit All");
            //fit.Click += (e, f) =>
            //{

            //};

            var timeline = m.AddMenuItem("Use this timespan");
            timeline.Click += (e, f) =>
            {
                AppState.TimelineManager.Start = DateTimeAxis.ToDateTime(dateAxis.ActualMinimum);
                AppState.TimelineManager.End = DateTimeAxis.ToDateTime(dateAxis.ActualMaximum);
                AppState.TimelineManager.ForceTimeChanged();
            };
            var fitall = m.AddMenuItem("Auto fit all");
            fitall.Click += (e, f) =>
            {
                FitAllDataSets();
            };
            AppState.Popups.Add(m);
        }
Exemplo n.º 41
0
 private void CreateExit()
 {
     Exit = new SurfaceButton();
     try
     {
         ImageBrush buttonBrush = new ImageBrush(new BitmapImage(new Uri("Resources/Images/X.jpg", UriKind.Relative)));
         Exit.Background = buttonBrush;
     }
     catch (Exception e)
     {
         Exit.Content = e.Message;
     }
     Exit.PreviewTouchUp += new EventHandler<TouchEventArgs>(ExitUp);
     canvas.Children.Add(Exit);
 }
Exemplo n.º 42
0
        public void OpenFunctionOperationMenu(DataSet ds, SurfaceButton b)
        {
            var menu = new MenuPopupViewModel();
            menu.RelativeElement = b;
            menu.RelativePosition = new Point(0, 0);
            menu.TimeOut = new TimeSpan(0, 0, 0, 5);
            //menu.Point = _view.CreateLayer.TranslatePoint(new Point(0,0),Application.Current.MainWindow);
            menu.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            //menu.DisplayProperty = "ServiceName";
            menu.AutoClose = true;

            foreach (var a in Enum.GetValues(typeof(FunctionOperations)))
            {
                var mi = menu.AddMenuItem(a.ToString());
                mi.Click += (e, s) =>
                {
                    SelectedDataSet.FunctionOperation = (FunctionOperations)a;
                    UpdateDataSet(SelectedDataSet);
                    menu.Close();
                };
            }
            AppState.Popups.Add(menu);
        }
Exemplo n.º 43
0
        /// <summary>
        /// Once the children have been set up useing makeTree
        /// fills the Menus canvas with buttons to correspond to the sizes of the Squares
        /// </summary>
        private void FillDrawing()
        {
            if (canvas == null)
            {
                canvas = new Canvas();
            }
            foreach (Square block in children)
            {

                if (children.Count() == 1)
                {
                    if (block.VideoString != null && !block.VideoString.Equals(""))
                    {
                        SurfaceButton button = new SurfaceButton();
                        SetButton(button, block);
                        System.Windows.Data.Binding bind = new System.Windows.Data.Binding("Width");
                        bind.Source = button;
                        bind.Converter = new BindReducer();
                        TextBlock txt = block.GetTextBlockLeft();
                        txt.FontSize = 12;
                        txt.SetBinding(TextBlock.WidthProperty, bind);

                        StackPanel panel = new StackPanel();
                        panel.Children.Add(txt);

                        VideoPlayer player = new VideoPlayer(block.VideoString);

                        Viewbox vb = new Viewbox();

                        System.Windows.Data.Binding vbBind = new System.Windows.Data.Binding("ActualHeight");
                        vbBind.Source = txt;
                        vbBind.Converter = new HeightConverter();
                        vbBind.ConverterParameter = this;

                        vb.Child = player;
                        vb.SetBinding(Viewbox.HeightProperty, vbBind);
                        panel.Children.Add(vb);

                        FindRightFontSize(txt, block);

                        button.Content = panel;
                        canvas.Children.Add(button);

                    }
                    else if (block.singleImage != null)
                    {
                        if (block.singleImage.Placement != _Placement.Inline)
                        {
                            SurfaceButton button = new SurfaceButton();
                            SetButton(button, block);

                            System.Windows.Data.Binding bind = new System.Windows.Data.Binding("Width");
                            bind.Source = button;
                            bind.Converter = new BindReducer();
                            TextBlock txt = block.GetTextBlockLeft();

                            txt.SetBinding(TextBlock.WidthProperty, bind);

                            StackPanel panel = new StackPanel();

                            Image img = new Image();
                            img.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                            img.Stretch = Stretch.UniformToFill;
                            img.Source = new BitmapImage(new Uri(block.singleImage.Path, UriKind.Relative));

                            Viewbox vb = new Viewbox();

                            System.Windows.Data.Binding vbBind = new System.Windows.Data.Binding("ActualHeight");
                            vbBind.Source = txt;
                            vbBind.Converter = new HeightConverter();
                            vbBind.ConverterParameter = this;

                            vb.Child = img;
                            vb.SetBinding(Viewbox.HeightProperty, vbBind);

                            if (block.singleImage.Placement == _Placement.Bottom)
                            {
                                panel.Children.Add(txt);
                                panel.Children.Add(vb);
                            }
                            else
                            {
                                panel.Children.Add(vb);
                                panel.Children.Add(txt);
                            }
                            button.Content = panel;

                            FindRightFontSize(txt, block);
                            canvas.Children.Add(button);

                        }
                        else//inline
                        {
                            TextBlock visibleblock = block.GetTextBlockTop();
                            visibleblock.Measure(new Size(0, 0));
                            visibleblock.Arrange(new Rect(0, 0, 0, 0));

                            SurfaceButton button = new SurfaceButton();
                            SetButton(button, block);

                            System.Windows.Data.Binding bind = new System.Windows.Data.Binding("Width");
                            bind.Source = button;
                            bind.Converter = new BindReducer();
                            visibleblock.SetBinding(TextBlock.WidthProperty, bind);

                            System.Windows.Data.Binding binder = new System.Windows.Data.Binding("Height");
                            binder.Source = button;
                            binder.Converter = new BindReducer();
                            visibleblock.SetBinding(TextBlock.HeightProperty, binder);

                            FindRightFontSize(visibleblock, block);

                            button.Content = visibleblock;
                            canvas.Children.Add(button);

                        }
                    }
                    else if(block.Slides!=null && block.Slides.Count>0){

                        SurfaceButton button = new SurfaceButton();
                        SetButton(button, block);

                        System.Windows.Data.Binding bindWidth = new System.Windows.Data.Binding("Width");
                        bindWidth.Source = button;

                        System.Windows.Data.Binding bindHeight = new System.Windows.Data.Binding("Height");
                        bindHeight.Source = button;

                        SlideShow thisSlideShow = new SlideShow(block.Slides);
                        thisSlideShow.SetBinding(SlideShow.WidthProperty,bindWidth);
                        thisSlideShow.SetBinding(SlideShow.HeightProperty, bindHeight);
                        thisSlideShow.Background = block.BackGroundBrush;
                        button.Content = thisSlideShow;
                        canvas.Children.Add(button);
                    }
                    else
                    {
                        SurfaceButton button = new SurfaceButton();
                        SetButton(button, block);
                        System.Windows.Data.Binding bind = new System.Windows.Data.Binding("Width");
                        bind.Source = button;
                        bind.Converter = new BindReducer();
                        TextBlock txt = block.GetTextBlockLeft();
                        txt.SetBinding(TextBlock.WidthProperty, bind);
                        txt.ClipToBounds = false;

                        FindRightFontSize(txt, block);
                        button.Content = txt;
                        canvas.Children.Add(button);

                    }
                }
                else
                {//regular menu
                    SurfaceButton button = new SurfaceButton();
                    SetButton(button, block);
                    canvas.Children.Add(button);
                    TextBlock text = block.GetTextBlock();
                    text.Measure(new Size(0, 0));
                    text.Arrange(new Rect(0, 0, 0, 0));

                    //centers text better if they are not content of the button
                    canvas.Children.Add(text);
                }
            }
        }
Exemplo n.º 44
0
        public override void OnApplyTemplate() {
            //csCommon.Resources.FloatingStyles fs = new FloatingStyles();
            //var ct = fs.FindName("SimpleFloatingStyle") as ControlTemplate;

            base.OnApplyTemplate();
            if (DesignerProperties.GetIsInDesignMode(this)) return;

            AppStateSettings.Instance.FullScreenFloatingElementChanged += InstanceFullScreenFloatingElementChanged;


            if (_fe.Style != null) {
                SetBinding(StyleProperty,
                    new Binding {
                        Source = _fe,
                        Path = new PropertyPath("Style"),
                        Mode = BindingMode.TwoWay,
                        UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                    });
            }

            //this.Style = this.FindResource("SimpleContainer") as Style;

            _svi.BorderThickness = new Thickness(0, 0, 0, 0);

            _svi.SingleInputRotationMode = (_fe.RotateWithFinger)
                ? SingleInputRotationMode.Default
                : SingleInputRotationMode.Disabled;

            _svi.ContainerManipulationDelta += _svi_ScatterManipulationDelta;


            _fe.ScatterViewItem = _svi;

            if (!_fe.ShowShadow) {
                SurfaceShadowChrome ssc;
                ssc = _svi.Template.FindName("shadow", _svi) as SurfaceShadowChrome;
                _svi.BorderBrush = null;
                _svi.Background = null;
                if (ssc != null) ssc.Visibility = Visibility.Hidden;
            }

            var closeButton = GetTemplateChild("PART_Close") as Button;
            if (closeButton != null)
                closeButton.Click += CloseButtonClick;

            _partAssociation = GetTemplateChild("PART_Association") as Line;
            _partContent = GetTemplateChild("PART_Content") as Grid;
            _partPreview = GetTemplateChild("PART_Preview") as FrameworkElement;
            _partStream = GetTemplateChild("PART_Stream") as SurfaceButton;
            _cpView = GetTemplateChild("cpView") as FrameworkElement;
            if (_fe == null) return;
            DataContext = _fe;

            _fe.CloseRequest += FeCloseRequest;
            _fe.ResetRequest += _fe_ResetRequest;


            _svi.SetBinding(WidthProperty,
                new Binding {Source = _fe, Path = new PropertyPath("Width"), Mode = BindingMode.Default});
            _svi.SetBinding(HeightProperty,
                new Binding {Source = _fe, Path = new PropertyPath("Height"), Mode = BindingMode.Default});

            _resize = GetTemplateChild("bResize") as Border;
            if (_resize != null) {
                SetResize(_resize);
            }

            UpdateAssociatedLine();

            var resizeBack = GetTemplateChild("bResize1") as Border;
            if (resizeBack != null) {
                SetResize(resizeBack);
            }

            _cc = GetTemplateChild("cpView") as ContentControl;

            // check for document, if not exist use ModelInstance
            if (_fe.Document != null) {
                IDocument vm = null;
                _fe.ConnectChannel = _fe.Document.Channel;
                _fe.ConnectMessage = _fe.Document.ToString();
                switch (_fe.Document.FileType) {
                    case FileTypes.image:
                        vm = new ImageViewModel {Doc = _fe.Document};
                        break;
                    case FileTypes.imageFolder:
                        vm = new ImageFolderViewModel {Doc = _fe.Document};
                        break;
                    case FileTypes.xps:
                        vm = new XpsViewModel {Doc = _fe.Document};
                        break;
                    case FileTypes.video:
                        vm = new VideoViewModel {Doc = _fe.Document};
                        break;
                    case FileTypes.web:
                        vm = new WebViewModel {Doc = _fe.Document};
                        break;
                    case FileTypes.html:
                        vm = new HtmlViewModel {Doc = _fe.Document};
                        break;
                }
                if (vm != null) {
                    var b = ViewLocator.LocateForModel(vm, null, null) as FrameworkElement;
                    if (b != null) {
                        b.Width = double.NaN;
                        b.Height = double.NaN;
                        b.HorizontalAlignment = HorizontalAlignment.Stretch;
                        b.VerticalAlignment = VerticalAlignment.Stretch;
                        ViewModelBinder.Bind(vm, b, null);
                        if (_cc != null) _cc.Content = b;
                    }
                }
            }
            else if (_fe.ModelInstance != null) {
                try {
                    var b = ViewLocator.LocateForModel(_fe.ModelInstance, null, null) as FrameworkElement;
                    if (b != null) {
                        b.HorizontalAlignment = HorizontalAlignment.Stretch;
                        b.VerticalAlignment = VerticalAlignment.Stretch;
                        ViewModelBinder.Bind(_fe.ModelInstance, b, null);
                        if (_cc != null) _cc.Content = b;
                    }
                }
                catch (Exception e) {
                    Logger.Log("Floating Container", "Error adding floating element", e.Message, Logger.Level.Error);
                }
            }

            UpdateBackInstance();

            if (_fe.DockingStyle == DockingStyles.None)
                if (_partPreview != null) _partPreview.Visibility = Visibility.Collapsed;

            _svi.PreviewTouchDown += (e, s) => {
                if (_svi.TouchesOver.Count() == 4) {
                    SwitchFullscreen();
                    s.Handled = true;
                    _svi.ReleaseAllTouchCaptures();
                }
                //return;
                // FIXME TODO: Unreachable code
//                if (!InteractiveSurface.PrimarySurfaceDevice.IsFingerRecognitionSupported)
//                    return;
//
//
//                _touchDown = DateTime.Now;
//                if (s.TouchDevice.GetIsFingerRecognized()) {
//                    _fe.OriginalOrientation = s.Device.GetOrientation(this);
//                    //double angle = s.TouchDevice.GetOrientation(Application.Current.MainWindow);
//                    //_reverse = (angle < 180);
//                }
//
//                if (!s.TouchDevice.GetIsFingerRecognized() &&
//                    !s.TouchDevice.GetIsTagRecognized()) {
//                    if (!string.IsNullOrEmpty(_fe.ConnectChannel) &&
//                        DateTime.Now > _lastBlobEvent.AddSeconds(1)) {
//                        AppStateSettings.Instance.Imb.SendMessage(_fe.ConnectChannel,
//                            _fe.ConnectMessage);
//                        s.Handled = true;
//                        _lastBlobEvent = DateTime.Now;
//                    }
//                }


                //Console.WriteLine(d.ToString());
            };
            //_svi.PreviewTouchUp += (e, s) =>
            //            {
            //              if (!_fe.Large && _touchDown.AddMilliseconds(300) > DateTime.Now && _fe.LastContainerPosition!=null)
            //              {
            //                ResetLastPosition();
            //              }
            //            };

            _svi.PreviewMouseDown += (e, s) => { _touchDown = DateTime.Now; };
            _svi.PreviewMouseUp += (e, s) => {
                if (!_fe.Large && _touchDown.AddMilliseconds(300) > DateTime.Now &&
                    _fe.LastContainerPosition != null) {
                    ResetLastPosition();
                }
            };

            if (_fe.IsFullScreen) {
                FrameworkElement fe = Application.Current.MainWindow;
                _svi.Center = new Point(fe.Width/2, fe.Height/2);
                _svi.Width = fe.Width;
                _svi.Height = fe.Height;
                _svi.Opacity = _fe.OpacityNormal;
            }

            if (_partStream != null) {
                _partStream.Click += _partStream_Click;
            }

            //b.HorizontalAlignment = HorizontalAlignment.Stretch;
            //b.VerticalAlignment = VerticalAlignment.Stretch;
        }
Exemplo n.º 45
0
        private void SetButton(SurfaceButton button, Square block)
        {
            button.Background = block.BackGroundBrush;
            button.Height = block.Height;
            button.Width = block.Width;
            button.RenderTransform = new TranslateTransform(block.X, block.Y);
            button.Foreground = block.TextBrush;
            button.BorderBrush = Brushes.Black;
            button.Padding = new Thickness(5, 5, 5, 0);

            block.Button = button;
        }
Exemplo n.º 46
0
        private void load(TextureStore textures)
        {
            game.Parse(store, textures, room.Value.Game);

            dependencies.Cache(room.Value.Players.Single(p => p?.BackingUser?.ID == api.LocalUser.Value.ID));

            RelativeSizeAxes = Axes.Both;

            InternalChildren = new Drawable[]
            {
                roomUpdater,
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Colour4(106, 100, 104, 255)
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Relative, .1f),
                        new Dimension(),
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Colour4(60, 60, 60, 255)
                                    },
                                    new Container
                                    {
                                        Anchor           = Anchor.TopLeft,
                                        Origin           = Anchor.TopLeft,
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = .2f,
                                        Children         = new Drawable[]
                                        {
                                            new SimpleIconButton(FontAwesome.Solid.SignOutAlt)
                                            {
                                                Anchor = Anchor.Centre,
                                                Origin = Anchor.Centre,
                                                Action = exitRoom,
                                            },
                                        }
                                    },
                                    new Container
                                    {
                                        Anchor           = Anchor.TopRight,
                                        Origin           = Anchor.TopRight,
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = .2f,
                                        Children         = new Drawable[]
                                        {
                                            new SimpleIconButton(FontAwesome.Solid.Envelope)
                                            {
                                                Anchor = Anchor.Centre,
                                                Origin = Anchor.Centre,
                                                Action = inviteOverlay.Show,
                                            },
                                        }
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Child            = new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding(50),
                                    Children         = new Drawable[]
                                    {
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            Height           = 1000,
                                            Child            = new FillFlowContainer
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Direction        = FillDirection.Vertical,
                                                Children         = new Drawable[]
                                                {
                                                    new SpriteText
                                                    {
                                                        Text = @"Jugadores:",
                                                        Font = new FontUsage(size: 80)
                                                    },
                                                    new BasicScrollContainer
                                                    {
                                                        RelativeSizeAxes = Axes.X,
                                                        Height           = 1000,
                                                        ClampExtension   = 30,
                                                        Masking          = true,
                                                        Child            = usersInRoom = new FillFlowContainer
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            AutoSizeAxes     = Axes.Y,
                                                            Direction        = FillDirection.Full,
                                                            Spacing          = new Vector2(0, 20),
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Height           = .15f,
                                            Child            = continueButton = new SurfaceButton
                                            {
                                                Action           = playGame,
                                                BackgroundColour = Colour4.LightPink,
                                                Children         = new Drawable[]
                                                {
                                                    textButton = new SpriteText
                                                    {
                                                        Anchor = Anchor.Centre,
                                                        Origin = Anchor.Centre,
                                                        Font   = new FontUsage(size: 80),
                                                        Colour = new Colour4(106, 100, 104, 255)
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                inviteOverlay,
                gameStack = new ScreenStack
                {
                    RelativeSizeAxes = Axes.Both,
                },
            };

            Schedule(() => LoadComponentAsync(new GameScreen(), gameStack.Push));

            if (api.LocalUser.Value.ID == room.Value.Owner.BackingUser.ID)
            {
                textButton.Text = "Jugar!";
            }
            else
            {
                textButton.Text = "Listo!";
            }

            for (int i = 0; i < room.Value.Game.Maxplayers; i++)
            {
                usersInRoom.Add(new PlayerInfoContainer(i));
            }


            gameStack.Hide();
        }
Exemplo n.º 47
0
        private void colorPick_Click(object sender, RoutedEventArgs e)
        {
            SurfaceButton sb = (SurfaceButton)sender;

            inkCanvas.DefaultDrawingAttributes.Color = ((SolidColorBrush)sb.Background).Color;
        }
Exemplo n.º 48
0
 /// <summary>
 /// adds event handler to all children
 /// </summary>
 /// <param name="target"></param>
 public virtual Square Get(SurfaceButton sqr)
 {
     return children.Get(sqr);
 }
 // Sets the passed button's width and height to be equal to size.
 private void SetButtonSize(SurfaceButton button, Double size)
 {
     button.Height = size;
     button.Width = size;
 }
Exemplo n.º 50
0
        // Using a DependencyProperty as the backing store for Folders.  This enables animation, styling, binding, etc...

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Pdfs = new Queue<FileInfo>();

            if (Execute.InDesignMode) return;
            PresenterLayers = AppStateSettings.Instance.ViewDef.FindOrCreateGroupLayer("Presenter");

            Folders = new ObservableCollection<Folder>();

            if (StartPath != null)
            {
                StartDirectory = new DirectoryInfo(StartPath);
                SelectFolder(StartPath);
            }

            sbBack = GetTemplateChild("Back") as SurfaceButton;
            var sbNext = GetTemplateChild("Next") as SurfaceButton;
            var sbPrevious = GetTemplateChild("Previous") as SurfaceButton;
            IcTitle = GetTemplateChild("icTitle") as ItemsControl;

            if (sbBack != null) sbBack.Click += SbBackClick;

            if (sbNext != null) sbNext.Click += SbNextClick;
            if (sbPrevious != null) sbPrevious.Click += SbPreviousClick;

            UpdateTitle();
        }
Exemplo n.º 51
0
        private void SetSkin()
        {
            string packUri = "pack://application:,,,/Resources/iphoneBody.png";

            Control.MainBg.ImageSource = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;

            // MAIN GRID DEFINITION
            RowDefinition r = new RowDefinition();

            r.Height = new GridLength(0.15, GridUnitType.Star);
            RowDefinition r1 = new RowDefinition();

            r1.Height = new GridLength(0.65, GridUnitType.Star);
            RowDefinition r2 = new RowDefinition();

            r2.Height = new GridLength(0.2, GridUnitType.Star);
            Control.MainGrid.RowDefinitions.Add(r);
            Control.MainGrid.RowDefinitions.Add(r1);
            Control.MainGrid.RowDefinitions.Add(r2);

            ColumnDefinition c = new ColumnDefinition();

            c.Width = new GridLength(0.07, GridUnitType.Star);
            ColumnDefinition c1 = new ColumnDefinition();

            c1.Width = new GridLength(0.86, GridUnitType.Star);
            ColumnDefinition c2 = new ColumnDefinition();

            c2.Width = new GridLength(0.07, GridUnitType.Star);
            Control.MainGrid.ColumnDefinitions.Add(c);
            Control.MainGrid.ColumnDefinitions.Add(c1);
            Control.MainGrid.ColumnDefinitions.Add(c2);

            Control.rdfWPF.SetValue(Grid.ColumnProperty, 1);
            Control.rdfWPF.SetValue(Grid.RowProperty, 1);

            Control.Footer.SetValue(Grid.ColumnProperty, 1);
            Control.Footer.SetValue(Grid.RowProperty, 2);

            // FOOTER GRID DEFINITION
            RowDefinition rf = new RowDefinition();

            rf.Height = new GridLength(0.2, GridUnitType.Star);
            RowDefinition rf1 = new RowDefinition();

            rf1.Height = new GridLength(0.5, GridUnitType.Star);
            RowDefinition rf2 = new RowDefinition();

            rf2.Height = new GridLength(0.3, GridUnitType.Star);
            Control.Footer.RowDefinitions.Add(rf);
            Control.Footer.RowDefinitions.Add(rf1);
            Control.Footer.RowDefinitions.Add(rf2);

            ColumnDefinition cf = new ColumnDefinition();

            cf.Width = new GridLength(0.38, GridUnitType.Star);
            ColumnDefinition cf1 = new ColumnDefinition();

            cf1.Width = new GridLength(0.24, GridUnitType.Star);
            ColumnDefinition cf2 = new ColumnDefinition();

            cf2.Width = new GridLength(0.38, GridUnitType.Star);
            Control.Footer.ColumnDefinitions.Add(cf);
            Control.Footer.ColumnDefinitions.Add(cf1);
            Control.Footer.ColumnDefinitions.Add(cf2);

            // HOME BUTTON
            SurfaceButton homeButton = new SurfaceButton();

            homeButton.Click              += new RoutedEventHandler(homeButton_Click);
            homeButton.Background          = System.Windows.Media.Brushes.Transparent;
            homeButton.BorderBrush         = System.Windows.Media.Brushes.Transparent;
            homeButton.VerticalAlignment   = VerticalAlignment.Stretch;
            homeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            homeButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            Control.Footer.Children.Add(homeButton);
            homeButton.SetValue(Grid.ColumnProperty, 1);
            homeButton.SetValue(Grid.RowProperty, 1);

            // HIDE BUTTON
            //SurfaceButton hideButton = new SurfaceButton();
            //hideButton.Click += new RoutedEventHandler(hideButton_Click);
            //hideButton.Background = System.Windows.Media.Brushes.Green;
            //hideButton.BorderBrush = System.Windows.Media.Brushes.Transparent;
            //hideButton.Opacity = 0.3;
            //hideButton.VerticalAlignment = VerticalAlignment.Stretch;
            //hideButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            //hideButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            //Control.Footer.Children.Add(hideButton);
            //hideButton.SetValue(Grid.ColumnProperty, 0);
            //hideButton.SetValue(Grid.RowProperty, 2);
            //hideButton.SetValue(Grid.ColumnSpanProperty, 3);

            // EXIT BUTTON
            //SurfaceButton closeButton = new SurfaceButton();
            //closeButton.Click += new RoutedEventHandler(Control.closeButton_Click);
            //closeButton.Background = System.Windows.Media.Brushes.Transparent;
            //closeButton.BorderBrush = System.Windows.Media.Brushes.Transparent;
            //closeButton.VerticalAlignment = VerticalAlignment.Top;
            //closeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            //closeButton.Padding = new Thickness(5);
            //closeButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");

            //var img = new System.Windows.Controls.Image();
            //string packUri1 = "pack://application:,,,/Resources/blackClose.png";
            //img.Source = new ImageSourceConverter().ConvertFromString(packUri1) as ImageSource;
            //closeButton.Content = img;

            //Control.MainGrid.Children.Add(closeButton);
            //closeButton.SetValue(Grid.ColumnProperty, 2);
            //closeButton.SetValue(Grid.RowProperty, 2);
        }