Ejemplo n.º 1
0
        public MenuPickerView(DesktopView parent)
        {
            this.parent = parent;
            InitializeComponent();

            PopulateMenuView();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// goto desktop mode
        /// </summary>
        /// <param name="param"></param>
        private void GotoDesktopMode(string param)
        {
            try
            {
                Hide();

                if (param.ToLower().StartsWith("browser"))
                {
                    desktopModeWindow = new DesktopView(this, param.ToLower());
                }
                else if (param.Contains("File"))
                {
                    param = Directory.GetFiles(Constants.AttachmentResources).FirstOrDefault(s => Path.GetFileNameWithoutExtension(s) == Path.GetFileNameWithoutExtension(param));

                    desktopModeWindow = new DesktopView(this, param);
                }
                else
                {
                    desktopModeWindow = new DesktopView(this, "");
                }

                if (desktopModeWindow != null)
                {
                    desktopModeWindow.Show();
                }
                else
                {
                    Show();
                }
            }
            catch (Exception ex)
            {
                App.InsertException(ex);
            }
        }
Ejemplo n.º 3
0
        public DeleteMenuForm(Model.Menu menu, DesktopView parent)
        {
            this.menu   = menu;
            this.parent = parent;

            InitializeComponent();

            CenterToScreen();
        }
Ejemplo n.º 4
0
        public ItemsOnMenuView(Model.Menu selectedMenu, DesktopView parent)
        {
            menu        = selectedMenu;
            this.parent = parent;

            InitializeComponent();

            PopulateItemLayout();

            //set interval for timer and enable timer.
            refreshItemsOnMenu.Interval = 5000;
            refreshItemsOnMenu.Enabled  = true;
            //start the timer
            refreshItemsOnMenu.Start();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Loads a session from a binary file reduced
        /// </summary>
        public void LoadReducedSession(FileStream ScStream, DesktopView desktop)
        {
            SessionSVI.BorderBrush = Brushes.White;
            SessionSVI.BorderThickness = new Thickness(15.0);

            SessionSVI.Width = SessionSVI.Width / 4.0 + 30.0;
            SessionSVI.Height = SessionSVI.Height / 4.0 + 30.0;

            Animation = new SessionAnimation(this, true, desktop);
            Animation.Fs = ScStream;
            Reduced = true;

            SessionSVI.CanScale = false;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Opens the workspace, adding the tab to the tab group.
 /// </summary>
 public override void Open()
 {
     DesktopView.AddWorkspaceView(this);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Launched when user is done with messing with a SVI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void svi_TouchLeave(object sender, TouchEventArgs e)
        {
            TouchHoldDispatcherTimer.Stop();
            if (SessionVM == null) return;
            if (SessionVM.DeleteButton.Visibility == Visibility.Visible) return;
            if (SessionVM.BeingDeleted) return;
            if (!SessionVM.Reduced) return;

            SessionVM.SessionSVI = (ScatterViewItem)SessionVM.Grid.Parent;
            MainDesktop = (DesktopView)((ScatterView)SessionVM.SessionSVI.Parent).Parent;

            double Width = MainDesktop.ActualWidth;
            double Height = MainDesktop.ActualHeight;
            double Xpos = e.GetTouchPoint(MainDesktop).Position.X;
            double Ypos = e.GetTouchPoint(MainDesktop).Position.Y;

            if (Ypos > 4.0 / 18.0 * Height && Ypos < 14.0 / 18.0 * Height)
            {
                if (Xpos > 0 && Xpos < 3.0 / 32.0 * Width && !MainDesktop.LeftSessionActive)
                {
                    SessionVM.Reduced = false;
                    EnlargeForSide(true);
                    SessionVM.DeleteButton.Visibility = Visibility.Hidden;
                    SessionVM.Orientation = "left";
                }
                else if (Xpos > 29.0 / 32.0 * Width && Xpos < Width && !MainDesktop.RightSessionActive)
                {
                    SessionVM.Reduced = false;
                    EnlargeForSide(false);
                    SessionVM.DeleteButton.Visibility = Visibility.Hidden;
                    SessionVM.Orientation = "right";
                }
            }

            if (MainDesktop.LeftSessionActive || MainDesktop.RightSessionActive) return;
            if (Xpos > 4.0 / 32.0 * Width && Xpos < 28.0 / 32.0 * Width)
            {
                if (Ypos > 0 && Ypos < 3.0 / 18.0 * Height && MainDesktop.Sessions.Items.Count == 0)
                {
                    SessionVM.Reduced = false;
                    Enlarge(-180.0);
                    SessionVM.DeleteButton.Visibility = Visibility.Hidden;
                    SessionVM.Orientation = "top";
                }

                else if (Ypos > 15.0 / 18.0 * Height && Ypos < Height && MainDesktop.Sessions.Items.Count == 0)
                {
                    SessionVM.Reduced = false;
                    Enlarge(0.0);
                    SessionVM.DeleteButton.Visibility = Visibility.Hidden;
                    SessionVM.Orientation = "bottom";
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Event occured when the session is totally enlarged
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void stb_enlarge_Completed(object sender, EventArgs e)
        {
            MainDesktop = (DesktopView)((ScatterView)SessionVM.SessionSVI.Parent).Parent;

            SessionVM.LoadSession();
            SessionVM.UpdateSound.Grid.Opacity = 0.0;
            Fs.Close();
            RemoveWhiteBorder();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Event occured when the reducing storyboard is completed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void stb_Completed(object sender, EventArgs e)
        {
            MainDesktop = (DesktopView)((ScatterView)(SessionVM.SessionSVI.Parent)).Parent;
            MainDesktop.UnhidePhotos();

            SessionVM.SessionSVI.BorderBrush = System.Windows.Media.Brushes.White;

            Storyboard stb = new Storyboard();
            ThicknessAnimation borderAnimation = new ThicknessAnimation();
            DoubleAnimation heightAnimation = new DoubleAnimation();
            ReduceWidthAnimation2 = new DoubleAnimation();

            borderAnimation.From = new Thickness(0.0);
            borderAnimation.To = new Thickness(15.0);
            borderAnimation.Duration = new Duration(TimeSpan.FromSeconds(.5));
            borderAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(borderAnimation);
            Storyboard.SetTarget(borderAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(borderAnimation, new PropertyPath(ScatterViewItem.BorderThicknessProperty));

            heightAnimation.From = SessionVM.SessionSVI.ActualHeight;
            heightAnimation.To = SessionVM.SessionSVI.ActualHeight + 30.0;
            heightAnimation.Duration = new Duration(TimeSpan.FromSeconds(.5));
            heightAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(heightAnimation);
            Storyboard.SetTarget(heightAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(heightAnimation, new PropertyPath(ScatterViewItem.HeightProperty));

            ReduceWidthAnimation2.From = SessionVM.SessionSVI.ActualWidth;
            ReduceWidthAnimation2.To = SessionVM.SessionSVI.ActualWidth + 30.0;
            ReduceWidthAnimation2.Duration = new Duration(TimeSpan.FromSeconds(.5));
            ReduceWidthAnimation2.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(ReduceWidthAnimation2);
            Storyboard.SetTarget(ReduceWidthAnimation2, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(ReduceWidthAnimation2, new PropertyPath(ScatterViewItem.WidthProperty));

            ReduceWidthAnimation2.Completed += new EventHandler(stb_border_Completed);
            stb.Begin(SessionVM.SessionSVI);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Reduce the screen with a snapshot
        /// </summary>
        public void Reduce()
        {
            if (SessionVM.Reduced) return;

            SessionVM.SessionSVI.MaxWidth = double.MaxValue;
            SessionVM.SessionSVI.MaxHeight = double.MaxValue;

            SessionVM.StopSound();
            SessionVM.StopPlayBar();

            foreach (MelodyBubbleViewModel mbvm in SessionVM.MbgVM.MelodyBubbleVMs)
            {
                mbvm.Animation.RemovePreview();
            }

            SessionVM.Session.StaveBottom.StopMelody();
            SessionVM.Session.StaveTop.StopMelody();

            SessionVM.IsPlaying = false;

            AudioController.PlaySoundWithString("flash");
            SessionVM.FullyEnlarged = false;

            MainDesktop = (DesktopView)((ScatterView)(SessionVM.SessionSVI.Parent)).Parent;

            stopAllBubblesAnimations();
            SessionVM.SaveSession();
            SessionVM.Session.StopBackgroundSound();

            MakeReadyForSnapShot(SessionVM.Grid);
            MemoryStream ms;
            if (SessionVM.Orientation == "left" || SessionVM.Orientation == "right") ms = new MemoryStream(Screenshot.GetSnapshot(SessionVM.Grid, 1, 100));
            else ms = new MemoryStream(Screenshot.GetSnapshot(SessionVM.Grid, 1, 100));
            System.Drawing.Image sc = System.Drawing.Image.FromStream(ms);

            string path = @"./SnapShots/sc" + SessionVM.SessionID.ToString() + ".jpg";

            if (File.Exists(path)) File.Delete(path);
            Fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
            sc.Save(Fs, ImageFormat.Jpeg);
            Fs.Close();

            #region Sets the SnapShot as SVI content
            //ss for snapshot
            ImageBrush ss = new ImageBrush();
            BitmapImage bi = new BitmapImage();
            Fs = new FileStream(path, FileMode.Open, FileAccess.Read);
            bi.BeginInit();
            bi.StreamSource = Fs;
            bi.EndInit();
            ss.ImageSource = bi;

            ReplaceGridWithSnapShot(ss);
            #endregion
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="s">The current SessionViewModel</param>
 /// <param name="reduced">True if the session is reduced</param>
 /// <param name="desktop">The DesktopView</param>
 public SessionAnimation(SessionViewModel s, bool reduced, DesktopView desktop)
     : base()
 {
     MainDesktop = desktop;
     SessionVM = s;
     SessionVM.SessionSVI.TouchLeave += new EventHandler<TouchEventArgs>(svi_TouchLeave);
     SessionVM.SessionSVI.PreviewTouchDown += new EventHandler<TouchEventArgs>(SessionSVI_TouchEnter);
 }
Ejemplo n.º 12
0
 public StockPickerView(DesktopView sender)
 {
     parent = sender;
     InitializeComponent();
 }