Exemplo n.º 1
0
        public void SetActiveTask(Tasks.Task newTask)
        {
            // first, are we active? If we aren't, there's no way
            // we ever activated a task, so there's no need to deactivate anything.
            if (IsFragmentActive == true)
            {
                // we are active, so if we have a current task, deactivate it.
                if (ActiveTask != null)
                {
                    ActiveTask.Deactivate(false);
                }

                // activate the new task
                newTask.Activate(false);

                // force the springboard to close
                if (MainActivity.IsLandscapeWide( ) == false)
                {
                    RevealSpringboard(false);
                }
            }
            else
            {
                // activate the new task
                newTask.Activate(false);
            }

            // take our active task. If we didn't activate it because we aren't
            // ready, we'll do it as soon as OnResume is called.
            ActiveTask = newTask;
        }
Exemplo n.º 2
0
        public void OnTaskChanged(Object sender)
        {
            ActiveTask.UpdateGeometry();

            KnifeShape.UpdateKnifeTool(ActiveKnifeTool);
            OnModelChanged(EnumModelType.MT_Task, EnumDataChange.DC_MODIFIED);
        }
Exemplo n.º 3
0
 public void OnFlick(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
 {
     // sanity check, as the events could be null.
     if (e1 != null && e2 != null)
     {
         // if they flicked it, go ahead and open / close the springboard.
         // to know they intended to flick and not scroll, ensure X is > Y
         if (Math.Abs(velocityX) > Math.Abs(velocityY))
         {
             // only allow it if we're NOT animating, the task is ok with us panning, and we're in portrait mode.
             if (Animating == false &&
                 ActiveTask.CanContainerPan( ) &&
                 Activity.Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait)
             {
                 if (velocityX > sMinVelocity)
                 {
                     RevealSpringboard(true);
                 }
                 else if (velocityX < -sMinVelocity)
                 {
                     RevealSpringboard(false);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        public void OnAnimationEnd(Animator animation)
        {
            Animating = false;

            InputViewChecker.BringToFront( );

            // based on the position, set the springboard flag
            if (View.GetX( ) == 0)
            {
                SpringboardRevealed = false;
                NavToolbar.Suspend(false);

                ToggleInputViewChecker(false);
            }
            else
            {
                SpringboardRevealed = true;
                NavToolbar.Suspend(true);

                if (MainActivity.IsLandscapeWide( ) == false)
                {
                    ToggleInputViewChecker(true);
                }
            }

            // notify the task regarding what happened
            ActiveTask.SpringboardDidAnimate(SpringboardRevealed);
        }
Exemplo n.º 5
0
    public void Start()
    {
        resource = GameObject.Find("Canvas-Resources").GetComponent <ResourceManager>(); //Load in the resource manager from our Scene in Unity.
        task     = GameObject.Find("Canvas-ActiveTask").GetComponent <ActiveTask>();

        caption = transform.GetComponent <Narrate.ProximityNarrationTrigger>();
    }
Exemplo n.º 6
0
        private void ActivateTab(Control page, bool okTouseTimer)
        {
            var task = (ITask)page.Tag;

            if (ActiveTask == task)
            {
                return;                 //debounce
            }

            if (ActiveTask != null)
            {
                ActiveTask.Deactivate();
                _activeTask = null;
            }
            if (task != null)
            {
                page.Cursor = Cursors.WaitCursor;
                page.Controls.Clear();
                if (Visible && okTouseTimer)
                {
                    ActivateAfterScreenDraw(page, task);
                }
                else
                {
                    ActivateTask(page, task);
                }
                UsageReporter.SendNavigationNotice(task.Label);
            }
        }
Exemplo n.º 7
0
        public void OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
        {
            // sanity check, as the events could be null.
            if (e1 != null && e2 != null)
            {
                // only allow it if we're NOT animating, the task is ok with us panning, and we're in portrait mode.
                if (Animating == false &&
                    ActiveTask.CanContainerPan( ) &&
                    Activity.Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait)
                {
                    switch (Panning)
                    {
                    case PanState.Monitoring:
                    {
                        TotalPanY += Math.Abs(e2.RawY - e1.RawY);
                        TotalPanX += Math.Abs(e2.RawX - e1.RawX);

                        FrameCount++;

                        if (FrameCount > sNumPanTrackingFrames)
                        {
                            // decide how to proceed
                            Panning = PanState.None;

                            // put simply, if their total X was more than their total Y, well then,
                            // lets pan.
                            if (TotalPanX > TotalPanY)
                            {
                                Panning = PanState.Panning;

                                // mark where the panning began, so we can move the field appropriately
                                PanStartX = e2.RawX;

                                PanelOriginX = View.GetX( );
                            }
                            else
                            {
                                // Y was greater than X, so they probably intended to scroll, not pan.
                                Panning = PanState.None;
                            }
                        }
                        break;
                    }

                    case PanState.Panning:
                    {
                        distanceX = e2.RawX - PanStartX;

                        float xPos         = PanelOriginX + distanceX;
                        float revealAmount = Springboard.GetSpringboardDisplayWidth( );
                        xPos = Math.Max(0, Math.Min(xPos, revealAmount));

                        PanContainerViews(xPos);
                        break;
                    }
                    }
                }
            }
        }
        public ActiveTaskViewModel(MainWindowViewModel vm)
        {
            this.vm = vm;

            this.activeTask = LoggedUser.Instance.GetUserTask();

            this.ActiveTaskTextBlock      = $"{this.activeTask.GetTaskName()}, Priorytet: {this.activeTask.GetTaskPriority()}";
            this.DescriptionTextBlock     = this.activeTask.GetTaskDescription();
            this.TimerActiveTaskTextBlock = this.activeTask.GetTaskStartTime();
        }
Exemplo n.º 9
0
        private void CloseActiveTask(object obj)
        {
            ActiveTask.Dispose();
            ActiveTask = null;
            //if(ActiveDeskTopTask != null)
            //{

            //    ActiveDeskTopTask.Close();
            //    ActiveDeskTopTask = null;
            //}
        }
Exemplo n.º 10
0
        public void Close(bool shutdown)
        {
            _shutdown = shutdown;

            RemoveAllTasks();

            if (ActiveTask != null)
            {
                ActiveTask.Cancel();
            }
        }
        /// <summary>
        /// Signals the current task to stop
        /// </summary>
        /// <param name="waitForIt">If 'true' the method will block until the current task is finished, otherwise returns immediately</param>
        public void Stop(bool waitForIt)
        {
            if (_cancellationTokenSource != null)
            {
                lock (_innerLock)
                    _cancellationTokenSource?.Cancel();
            }

            if (waitForIt) //TODO may not work
            {
                ActiveTask?.GetAwaiter().GetResult();
            }
        }
Exemplo n.º 12
0
        public void ActivateTask(Task task)
        {
            if (Equals(task, ActiveTask))
            {
                return;
            }

            ActiveTask?.Open();
            task.Activate();
            ActiveTask = task;
            OnPropertyChanged(nameof(ActiveTask));
            OnTaskChanged(task, TaskAction.Activate);
            _repository.UpdateTask(task.Id, task);
        }
Exemplo n.º 13
0
        public void OnUp(MotionEvent e)
        {
            // if we were panning
            if (Panning == PanState.Panning)
            {
                float revealAmount = Springboard.GetSpringboardDisplayWidth( );
                if (SpringboardRevealed == false)
                {
                    // since the springboard wasn't revealed, require that they moved
                    // at least 1/5th the amount before opening it
                    if (View.GetX( ) > revealAmount * .20f)
                    {
                        RevealSpringboard(true);
                    }
                    else
                    {
                        RevealSpringboard(false);
                    }
                }
                else
                {
                    if (View.GetX( ) < revealAmount * .85f)
                    {
                        RevealSpringboard(false);
                    }
                    else
                    {
                        RevealSpringboard(true);
                    }
                }
            }
            else
            {
                // if the task should allowe input, reveal the nav bar
                if (ShouldTaskAllowInput( ) == true)
                {
                    // let the active task know that the user released input
                    ActiveTask.OnUp(e);
                }
                else if (ShouldSpringboardAllowInput( ) == true)
                {
                    // else close the springboard
                    RevealSpringboard(false);
                }
            }

            // no matter what, we're done panning
            Panning = PanState.None;
        }
Exemplo n.º 14
0
        public override void OnResume( )
        {
            base.OnResume( );

            IsFragmentActive = true;

            if (ActiveTask != null)
            {
                ActiveTask.Activate(true);
            }

            SpringboardParent.NavbarWasResumed( );

            LayoutChanged( );
        }
Exemplo n.º 15
0
    public bool ListenJoyStickRotation(ActiveTask task)
    {
        var xAxis = Input.GetAxis("Horizontal") + Input.GetAxis("HoriNav");
        var yAxis = Input.GetAxis("Vertical") + Input.GetAxis("VertNav");

        var fuckYou = false;

        if (xAxis == 0 && yAxis == 0)
        {
            return(fuckYou);
        }

        var currentInputAngle = Mathf.Atan2(yAxis, xAxis) * Mathf.Rad2Deg;

        if (currentInputAngle < 0)
        {
            currentInputAngle += 360.0f;
        }

        if (currentInputAngle > 90.0f && currentInputAngle < 180.0f && previousInputAngle < 90.0f)
        {
            currentAngularDisplacement += currentInputAngle;
        }
        else if (currentInputAngle > 180.0f && currentInputAngle < 270.0f && previousInputAngle > 90.0f && previousInputAngle < 180.0f)
        {
            currentAngularDisplacement += currentInputAngle;
        }
        else if (currentInputAngle > 270.0f && currentInputAngle < 360.0f && previousInputAngle > 180.0f && previousInputAngle < 270.0f)
        {
            currentAngularDisplacement += currentInputAngle;
        }
        else if (currentInputAngle > 0.0f && currentInputAngle < 90.0f && previousInputAngle > 270.0f && previousInputAngle < 360.0f)
        {
            currentAngularDisplacement += currentInputAngle;
        }


        previousInputAngle = currentInputAngle;
        // Debug.Log("Delta" + delta);
        Debug.Log("CAD" + currentInputAngle);

        if (currentAngularDisplacement >= totalAngularDisplacment)
        {
            return(true);
        }

        return(false);
    }
Exemplo n.º 16
0
    public bool ListenButtonPress(ActiveTask task)
    {
        if (Input.GetButtonUp(inputIdentifiers.First()))
        {
            inputIdentifiers.RemoveAt(0);
            completedInputCount++;

            if (inputIdentifiers.Count == 0)
            {
                return(true);
            }
        }


        return(false);
    }
Exemplo n.º 17
0
        public override void OnPause( )
        {
            base.OnPause( );

            if (ActiveTask != null)
            {
                ActiveTask.Deactivate(true);
            }

            IsFragmentActive = false;

            // force the animation to end, because we're out of time.
            if (XPosAnimator != null)
            {
                XPosAnimator.End( );
            }
        }
 private void Img_MouseDown(object sender, MouseButtonEventArgs e)
 {
     ActiveTask.CaptureMouse();
     mousePosition = e.GetPosition(MasterScreen);
 }
Exemplo n.º 19
0
 private void OnLifetimeTerminate()
 {
     ActiveTask?.Pause();
 }
 private void Img_MouseUp(object sender, MouseButtonEventArgs e)
 {
     ActiveTask.ReleaseMouseCapture();
 }
Exemplo n.º 21
0
 private void SetActiveTask()
 {
     ActiveTask = FindActiveTask(OpenTasks);
     ActiveTask?.UnPause();
 }
Exemplo n.º 22
0
 public void OnPathChanged(Object sender)
 {
     ActiveTask.UpdateGeometry();
     OnModelChanged(EnumModelType.MT_Task, EnumDataChange.DC_MODIFIED);
 }