Example #1
0
        void DataItemEndChanging(DataItemEndChanging e)
        {
            if (!Dispatcher.CheckAccess()) // CheckAccess returns true if you're on the dispatcher thread
            {
                Dispatcher.Invoke(new DataItemEndChangingEventHandler(DataItemEndChanging), e);
                return;
            }
            switch (e.PropertyName)
            {
            case "PublicText":
                TextEditorPublicInfo.BorderBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3f3f46"));
                break;

            case "CurrentState":
                TextEditorCurrentState.BorderBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3f3f46"));
                break;

            case "Result":
                TextEditorResult.BorderBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3f3f46"));
                break;

            case "Description":
                TextEditorTargetState.BorderBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#3f3f46"));
                break;

            default:
                break;
            }
        }
Example #2
0
        private void TextResultPublicInfo_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            Todo todo = (Todo)todoViewSource.View.CurrentItem;

            if (todo != null)
            {
                string propertyName = string.Empty;
                switch (((Control)sender).Name)
                {
                case "TextEditorPublicInfo":
                    propertyName = "PublicText";
                    break;

                case "TextEditorCurrentState":
                    propertyName = "CurrentState";
                    break;

                case "TextEditorResult":
                    propertyName = "Result";
                    break;

                case "TextEditorTargetState":
                    propertyName = "Description";
                    break;

                default:
                    break;
                }
                DataItemEndChanging data = new DataItemEndChanging()
                {
                    PK           = todo.pId,
                    Type         = todo.GetType().ToString(),
                    PropertyName = propertyName
                };

                tornado14Observer.Send(new Package(SENDERID, 10, (int)EventMapping.DataItemEndChanging_17, Method.PUT, XmlSerializationHelper.Serialize(data)));


                DataItemChanged data2 = new DataItemChanged()
                {
                    PK           = todo.pId,
                    PropertyName = propertyName,
                    Value        = ((Tornado14.WPFControls.TEditor)(sender)).Text2,
                    Type         = todo.GetType().ToString(),
                };

                tornado14Observer.Send(new Package(SENDERID, 12, (int)EventMapping.DataItemChanged_13, Method.PUT, XmlSerializationHelper.Serialize(data2)));
            }
        }
Example #3
0
        private void HandlePUT(Package package)
        {
            if (package.Event == (int)EventMapping.DataItemChanged_13)
            {
                DataItemChanged putParams = XmlSerializationHelper.Desirialize <DataItemChanged>(package.Data);

                if (putParams.Type == typeof(Todo).ToString())
                {
                    Todo currentTodo = null;
                    foreach (Todo todo in TodoList)
                    {
                        if (todo.pId == putParams.PK)
                        {
                            currentTodo = todo;
                            break;
                        }
                    }
                    Todo.SetPropValue(currentTodo, putParams.PropertyName, putParams.Value);
                    currentTodo.DidNotReadLoL = true;
                }
                else if (putParams.Type == typeof(Project).ToString())
                {
                    Project currentProject = null;
                    foreach (Project project in ProjectList)
                    {
                        if (project.pId == putParams.PK)
                        {
                            currentProject = project;
                            break;
                        }
                    }
                    Project.SetPropValue(currentProject, putParams.PropertyName, putParams.Value);
                    currentProject.DidNotReadLoL = true;
                    selectedProject = currentProject;
                }
            }
            else if (package.Event == (int)EventMapping.CurrentItemChanged_15)
            {
                CurrentItemChanged putParams = XmlSerializationHelper.Desirialize <CurrentItemChanged>(package.Data);
                if (putParams.Type == typeof(Todo).ToString())
                {
                    object pk = TodoList.Where(todo => todo.pId == putParams.PK).First();
                    SelectedDataItemChanged(pk, putParams.Type);
                    selectedTodo = (Todo)pk;
                }
                else if (putParams.Type == typeof(Project).ToString())
                {
                    object pk = ProjectList.Where(project => project.pId == putParams.PK).First();
                    SelectedDataItemChanged(pk, putParams.Type);
                    selectedProject = (Project)pk;
                }
                else
                {
                    throw new Exception("Unknown Type");
                }
            }
            else if (package.Event == (int)EventMapping.DataItemBeginChanging_16)
            {
                DataItemBeginChanging putParams = XmlSerializationHelper.Desirialize <DataItemBeginChanging>(package.Data);
                DataItemStartChanging(putParams);
            }
            else if (package.Event == (int)EventMapping.DataItemEndChanging_17)
            {
                DataItemEndChanging putParams = XmlSerializationHelper.Desirialize <DataItemEndChanging>(package.Data);
                DataItemEndChanging(putParams);
            }
        }