Exemplo n.º 1
0
        public void RefreshProfile(GenDataBase genDataBase, GenObject genObject)
        {
            var selectedItem = ProfileNavigatorTreeView.SelectedNode;
            var dataProfile  = GenDataEditorViewModel.Data.Profile;

            dataProfile.Fragment = ProfileEditorTreeViewBuilder.GetNodeData(selectedItem);
            var text = dataProfile.GetNodeProfileText();

            // Don't change to prevent unnecessary rendering and side effects
            if (text != ProfileTextBox.Text)
            {
                var start = ProfileTextBox.SelectionStart;
                ProfileTextBox.Clear();
                ProfileTextBox.Text           = text;
                ProfileTextBox.SelectionStart = start;
            }


            text = dataProfile.GetNodeExpansionText(genDataBase, genObject);

            // Don't change to prevent unnecessary rendering and side effects
            if (text != ProfileExpansionTextBox.Text)
            {
                var start = ProfileExpansionTextBox.SelectionStart;
                ProfileExpansionTextBox.Clear();
                ProfileExpansionTextBox.Text           = text;
                ProfileExpansionTextBox.SelectionStart = start;
            }
        }
Exemplo n.º 2
0
        private void resetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //When user wants to reset form, they will click on Reset

            NameTextBox.Clear();
            FeelTextBox.Clear();
            YearTextBox.Clear();
            ProfileTextBox.Clear();
        }
Exemplo n.º 3
0
 private void Save()
 {
     if (ValidateForm())
     {
         string profileName = ProfileTextBox.Text.Trim();
         Data.AddProfile(profileName);
         Data.SelectedProfile = profileName;
         this.Close();
         this.Dispose();
     }
     else
     {
         ProfileTextBox.Text = string.Empty;
         ProfileTextBox.Focus();
     }
 }
Exemplo n.º 4
0
        public void LoadData()
        {
            ProfileNavigatorTreeView.Nodes.Clear();
            ProfileExpansionTextBox.Clear();
            ProfileTextBox.Clear();
            if (GenDataEditorViewModel == null || GenDataEditorViewModel.ProfileIsUndefined())
            {
                return;
            }

            var data = GenDataEditorViewModel.Data;

            data.Profile.Fragment = data.Profile.Profile;
            var builder = new ProfileEditorTreeViewBuilder(data);

            IsBuilding = true;
            builder.CreateBodyChildTrees(ProfileNavigatorTreeView.Nodes, data.Profile.GetBody());
            IsBuilding = false;
            if (ProfileNavigatorTreeView.Nodes.Count > 0)
            {
                ProfileNavigatorTreeView.SelectedNode = ProfileNavigatorTreeView.Nodes[0];
            }
        }
Exemplo n.º 5
0
        private void OnNuimoGestureEventAsync(NuimoGestureEvent nuimoGestureEvent)
        {
            OutputTextBox.Text = new StringBuilder(OutputTextBox.Text)
                                 .Append("NuimoGesture: ")
                                 .Append(nuimoGestureEvent.Gesture)
                                 .Append(" value: ")
                                 .Append(nuimoGestureEvent.Value + "\n")
                                 .ToString();

            try
            {
                if (nuimoGestureEvent.Gesture == NuimoGesture.ButtonPress)
                {
                    TriggerApp(_profile.ButtonPress);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.ButtonRelease)
                {
                    TriggerApp(_profile.ButtonRelease);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeUp)
                {
                    TriggerApp(_profile.SwipeUp);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeDown)
                {
                    TriggerApp(_profile.SwipeDown);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeLeft)
                {
                    TriggerApp(_profile.SwipeLeft);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.SwipeRight)
                {
                    TriggerApp(_profile.SwipeRight);
                }

                if (nuimoGestureEvent.Gesture == NuimoGesture.Rotate && nuimoGestureEvent.Value > _settings.rotateThreshold)
                {
                    TriggerApp(_profile.RotateRight);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.Rotate && nuimoGestureEvent.Value < (-1 * _settings.rotateThreshold))
                {
                    TriggerApp(_profile.RotateLeft);
                }

                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyUpDown && nuimoGestureEvent.Value >= 135)
                {
                    TriggerApp(_profile.FlyUp);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyUpDown && nuimoGestureEvent.Value <= 115 && nuimoGestureEvent.Value > 1)
                {
                    TriggerApp(_profile.FlyDown);
                }

                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyLeft)
                {
                    TriggerApp(_profile.FlyLeft);
                }
                if (nuimoGestureEvent.Gesture == NuimoGesture.FlyRight)
                {
                    TriggerApp(_profile.FlyRight);
                }

                if (ProfileTextBox != null)
                {
                    ProfileTextBox.ScrollToBottom();
                }
                if (OutputTextBox != null)
                {
                    OutputTextBox.ScrollToBottom();
                }
            }
            catch (Exception ex)
            {
                OutputTextBox.Text = new StringBuilder(OutputTextBox.Text)
                                     .Append("Exception : ")
                                     .Append(ex.Message)
                                     .Append("\n")
                                     .Append(ex.StackTrace)
                                     .Append("\n")
                                     .ToString();
            }
        }