示例#1
0
        void SetFieldsFromInfo(AnimationGroup info)
        {
            if (info != null)
            {
                nameTextBox.Enabled  = true;
                startTextBox.Enabled = true;
                endTextBox.Enabled   = true;
                nameTextBox.Text     = info.Name.ToString();
                startTextBox.Text    = info.FrameStart.ToString();
                endTextBox.Text      = info.FrameEnd.ToString();

                // a color can still be red after setting the string:
                // possible if we change a name, don't confirm and switch to another item with the same name
                ResetChangedTextBoxColors();

                if (info.IsDirty)
                {
                    InfoChanged?.Invoke(info);
                }
            }
            else
            {
                nameTextBox.Enabled  = false;
                startTextBox.Enabled = false;
                endTextBox.Enabled   = false;
                nameTextBox.Text     = "";
                startTextBox.Text    = "";
                endTextBox.Text      = "";
            }
        }
示例#2
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (currentInfo == null)
            {
                return;
            }

            AnimationGroup confirmedInfo = currentInfo;

            string newName = nameTextBox.Text;

            if (!int.TryParse(startTextBox.Text, out int newFrameStart))
            {
                newFrameStart = confirmedInfo.FrameStart;
            }
            if (!int.TryParse(endTextBox.Text, out int newFrameEnd))
            {
                newFrameEnd = confirmedInfo.FrameEnd;
            }

            confirmedInfo.Name       = newName;
            confirmedInfo.FrameStart = newFrameStart;
            confirmedInfo.FrameEnd   = newFrameEnd;

            ResetChangedTextBoxColors();

            InfoChanged?.Invoke(confirmedInfo);
            ConfirmPressed?.Invoke(confirmedInfo);
        }
示例#3
0
        private void UpdateInfo()
        {
            if (SelectedIndexes.Count == 1)
            {
                Info = $"Index: {SelectedIndexes[0]}";
            }
            else
            {
                Info = "";
            }

            InfoChanged?.Invoke(this, new EventArgs());
        }
示例#4
0
 /// <summary>
 /// Called when a property in this class has changed its value.
 /// </summary>
 /// <param name="m_propertyName">Name of the m_property.</param>
 /// <param name="m_message">The m_message.</param>
 private void OnInfoChanged(string m_propertyName, string m_message = "A property has changed.")
 {
     if (InfoChanged != null && !(InfoChanged.GetInvocationList().Length > 0))
     {
         foreach (BatteryInfoChangedEventHandler m_handler in InfoChanged.GetInvocationList())
         {
             m_handler(this, new OnBatteryInfoChangedEventArgs()
             {
                 Device = this.device, Message = m_message, PropertyName = m_propertyName
             });
         }
     }
 }
示例#5
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (currentInfo == null)
            {
                return;
            }

            AnimationGroup confirmedInfo = currentInfo;

            string newName = nameTextBox.Text;

            int newFrameStart;

            if (!int.TryParse(startTextBox.Text, out newFrameStart))
            {
                newFrameStart = confirmedInfo.FrameStart;
            }
            int newFrameEnd;

            if (!int.TryParse(endTextBox.Text, out newFrameEnd))
            {
                newFrameEnd = confirmedInfo.FrameEnd;
            }

            List <uint> newHandles;
            bool        nodesChanged = MaxNodeTree.ApplyQueuedChanges(out newHandles);

            bool changed = newName != confirmedInfo.Name || newFrameStart != confirmedInfo.FrameStart || newFrameEnd != confirmedInfo.FrameEnd || nodesChanged;

            if (!changed)
            {
                return;
            }

            confirmedInfo.Name       = newName;
            confirmedInfo.FrameStart = newFrameStart;
            confirmedInfo.FrameEnd   = newFrameEnd;

            if (nodesChanged)
            {
                confirmedInfo.NodeGuids = newHandles.ToGuids();
            }

            ResetChangedTextBoxColors();
            MaxNodeTree.SelectedNode = null;

            InfoChanged?.Invoke(confirmedInfo);
            ConfirmPressed?.Invoke(confirmedInfo);
        }
示例#6
0
        void SetFieldsFromInfo(AnimationGroup info)
        {
            if (info != null)
            {
                nameTextBox.Enabled  = true;
                startTextBox.Enabled = true;
                endTextBox.Enabled   = true;
                nameTextBox.Text     = info.Name.ToString();
                startTextBox.Text    = info.FrameStart.ToString();
                endTextBox.Text      = info.FrameEnd.ToString();

                // a color can still be red after setting the string:
                // possible if we change a name, don't confirm and switch to another item with the same name
                ResetChangedTextBoxColors();

                MaxNodeTree.BeginUpdate();
                //here we garanty retrocompatibility
                MaxNodeTree.QueueSetNodes(info.NodeGuids.ToHandles(), false);
                List <uint> handles;
                MaxNodeTree.ApplyQueuedChanges(out handles, false);
                MaxNodeTree.EndUpdate();

                // if the nodes changed on max' side, even though the data has not changed, the list may be different (e.g. deleted nodes)
                // since we haven't loaded the list before, we can't compare it to the node tree
                // thus, we save it, and the property checks for actual differences (and set isdirty to true)
                info.NodeGuids = handles.ToGuids();

                if (info.IsDirty)
                {
                    InfoChanged?.Invoke(info);
                }
            }
            else
            {
                nameTextBox.Enabled  = false;
                startTextBox.Enabled = false;
                endTextBox.Enabled   = false;
                nameTextBox.Text     = "";
                startTextBox.Text    = "";
                endTextBox.Text      = "";

                MaxNodeTree.BeginUpdate();
                MaxNodeTree.QueueSetNodes(null, false);
                List <uint> handles;
                MaxNodeTree.ApplyQueuedChanges(out handles, false);
                MaxNodeTree.EndUpdate();
            }
        }
示例#7
0
        void SetFieldsFromInfo(AnimationGroup info)
        {
            if (info != null)
            {
                nameTextBox.Enabled  = true;
                startTextBox.Enabled = true;
                endTextBox.Enabled   = true;
                nameTextBox.Text     = info.Name.ToString();
                startTextBox.Text    = info.FrameStart.ToString();
                endTextBox.Text      = info.FrameEnd.ToString();

                MaxNodeTree.BeginUpdate();
                MaxNodeTree.QueueSetNodes(info.NodeHandles, false);
                MaxNodeTree.ApplyQueuedChanges(out List <uint> handles, false);
                MaxNodeTree.EndUpdate();

                // if the nodes changed on max' side, even though the data has not changed, the list may be different (e.g. deleted nodes)
                // since we haven't loaded the list before, we can't compare it to the node tree
                // thus, we save it, and the property checks for actual differences (and set isdirty to true)
                info.NodeHandles = handles;

                if (info.IsDirty)
                {
                    InfoChanged?.Invoke(info);
                }
            }
            else
            {
                nameTextBox.Enabled  = false;
                startTextBox.Enabled = false;
                endTextBox.Enabled   = false;
                nameTextBox.Text     = "";
                startTextBox.Text    = "";
                endTextBox.Text      = "";

                MaxNodeTree.BeginUpdate();
                MaxNodeTree.QueueSetNodes(null, false);
                MaxNodeTree.ApplyQueuedChanges(out List <uint> handles, false);
                MaxNodeTree.EndUpdate();
            }
        }
示例#8
0
        private void ApplyButton_OnClick(object sender, RoutedEventArgs e)
        {
            var dob      = DobPicker.SelectedDate.GetValueOrDefault();
            var person   = ParsePerson(SurnameBox.Text, NameBox.Text, PatrBox.Text, dob);
            var passport = ParsePassport(PassBox.Text);
            var phone    = ParsePhone(PhoneBox.Text);

            if (InputValid(person, passport, phone))
            {
                _tenant.PersonInfo     = person;
                _tenant.PassportNumber = passport;
                _tenant.PhoneNumber    = phone;
                _service.UpdateTenant(_tenant);
                MessageBox.Show("Изменения сохранены.");
                InfoChanged?.Invoke();
                SetInputState(true);
            }
            else
            {
                MessageBox.Show("Одно или несколько полей заполнены неверно.", "Ошибка при вводе данных",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ApplyButton_OnClick(object sender, RoutedEventArgs e)
        {
            var res         = ResChBox.IsChecked ?? false;
            var furn        = FurnChBox.IsChecked ?? false;
            var park        = ParkChBox.IsChecked ?? false;
            var priceString = $"{RubBox.Text}.{DecBox.Text}";

            var address     = ParseAddress(CityBox.Text, StreetBox.Text, BuildingBox.Text, AptBox.Text);
            var roomsParsed = int.TryParse(RoomBox.Text, out var roomCount);
            var areaParsed  =
                double.TryParse(AreaBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out var area);
            var priceParsed =
                decimal.TryParse(priceString, NumberStyles.Any, CultureInfo.InvariantCulture, out var price);

            if (PropInputValid(address, roomsParsed, areaParsed, priceParsed) &&
                PropAmountsValid(roomCount, area, price))
            {
                _prop.Address       = address;
                _prop.RoomCount     = roomCount;
                _prop.Area          = area;
                _prop.IsResidential = res;
                _prop.IsFurnished   = furn;
                _prop.HasParking    = park;
                _prop.MonthlyPrice  = price;
                _service.UpdateProperty(_prop);
                MessageBox.Show("Изменения сохранены.");
                InfoChanged?.Invoke();

                SetInputState(true);
            }
            else
            {
                MessageBox.Show("Одно или несколько полей заполнены неверно.", "Ошибка при вводе данных",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#10
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (currentInfo == null)
            {
                return;
            }

            AnimationGroup confirmedInfo = currentInfo;

            string newName = nameTextBox.Text;

            int newFrameStart;

            if (!int.TryParse(startTextBox.Text, out newFrameStart))
            {
                newFrameStart = confirmedInfo.FrameStart;
            }
            int newFrameEnd;

            if (!int.TryParse(endTextBox.Text, out newFrameEnd))
            {
                newFrameEnd = confirmedInfo.FrameEnd;
            }

            List <uint> newHandles;
            bool        nodesChanged = MaxNodeTree.ApplyQueuedChanges(out newHandles);

            bool changed = newName != confirmedInfo.Name || newFrameStart != confirmedInfo.FrameStart || newFrameEnd != confirmedInfo.FrameEnd || nodesChanged;

            if (!changed)
            {
                return;
            }

            confirmedInfo.Name       = newName;
            confirmedInfo.FrameStart = newFrameStart;
            confirmedInfo.FrameEnd   = newFrameEnd;

            if (nodesChanged)
            {
                confirmedInfo.NodeGuids = newHandles.ToGuids();
                if (confirmedInfo.AnimationGroupNodes == null)
                {
                    confirmedInfo.AnimationGroupNodes = new List <AnimationGroupNode>();
                }

                foreach (uint handle in newHandles)
                {
                    IINode node = Loader.Core.GetINodeByHandle(handle);
                    if (node != null)
                    {
                        string             name       = node.Name;
                        string             parentName = node.ParentNode.Name;
                        AnimationGroupNode nodeData   = new AnimationGroupNode(node.GetGuid(), name, parentName);
                        confirmedInfo.AnimationGroupNodes.Add(nodeData);
                    }
                }
            }

            ResetChangedTextBoxColors();
            MaxNodeTree.SelectedNode = null;

            InfoChanged?.Invoke(confirmedInfo);
            ConfirmPressed?.Invoke(confirmedInfo);
        }
示例#11
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (currentInfo == null)
            {
                return;
            }

            AnimationGroup confirmedInfo = currentInfo;

            string newName = nameTextBox.Text;

            bool newKeepEmpty       = keepStaticAnimBox.Checked;
            bool newKeepNonAnimated = keepNonAnimatedBox.Checked;

            int newFrameStart;

            if (!int.TryParse(startTextBox.Text, out newFrameStart))
            {
                newFrameStart = confirmedInfo.FrameStart;
            }
            int newFrameEnd;

            if (!int.TryParse(endTextBox.Text, out newFrameEnd))
            {
                newFrameEnd = confirmedInfo.FrameEnd;
            }

            List <uint>  newHandles;
            bool         nodesChanged = MaxNodeTree.ApplyQueuedChanges(out newHandles);
            IList <Guid> newMaterialGUIDs;
            bool         materialsChanged = maxMaterialView.ApplyMaterialsChanges(out newMaterialGUIDs);

            bool changed = newKeepEmpty != confirmedInfo.KeepStaticAnimation ||
                           newName != confirmedInfo.Name ||
                           newFrameStart != confirmedInfo.FrameStart ||
                           newFrameEnd != confirmedInfo.FrameEnd ||
                           nodesChanged ||
                           materialsChanged ||
                           newKeepNonAnimated != confirmedInfo.KeepNonAnimated;

            if (!changed)
            {
                return;
            }

            confirmedInfo.Name                = newName;
            confirmedInfo.FrameStart          = newFrameStart;
            confirmedInfo.FrameEnd            = newFrameEnd;
            confirmedInfo.KeepStaticAnimation = newKeepEmpty;
            confirmedInfo.KeepNonAnimated     = newKeepNonAnimated;

            if (nodesChanged)
            {
                confirmedInfo.NodeGuids = newHandles.ToGuids();
                if (confirmedInfo.AnimationGroupNodes == null)
                {
                    confirmedInfo.AnimationGroupNodes = new List <AnimationGroupNode>();
                }

                foreach (uint handle in newHandles)
                {
                    IINode node = Loader.Core.GetINodeByHandle(handle);
                    if (node != null)
                    {
                        string             name       = node.Name;
                        string             parentName = node.ParentNode.Name;
                        AnimationGroupNode nodeData   = new AnimationGroupNode(node.GetGuid(), name, parentName);
                        confirmedInfo.AnimationGroupNodes.Add(nodeData);
                    }
                }
            }

            if (materialsChanged)
            {
                confirmedInfo.MaterialGuids = newMaterialGUIDs;

                if (confirmedInfo.AnimationGroupMaterials == null)
                {
                    confirmedInfo.AnimationGroupMaterials = new List <AnimationGroupMaterial>();
                }

                foreach (Guid guid in newMaterialGUIDs)
                {
                    IMtl mat = Tools.GetIMtlByGuid(guid);
                    if (mat != null)
                    {
                        string name = mat.Name;
                        AnimationGroupMaterial matData = new AnimationGroupMaterial(guid, name);
                        confirmedInfo.AnimationGroupMaterials.Add(matData);
                    }
                }
            }

            ResetChangedTextBoxColors();
            MaxNodeTree.SelectedNode = null;

            InfoChanged?.Invoke(confirmedInfo);
            ConfirmPressed?.Invoke(confirmedInfo);
        }
示例#12
0
 public void ChangeInfo(Info info)
 {
     Info = info;
     InfoChanged?.Invoke(info);
 }
示例#13
0
 public void ChangeInfo(Person info)
 {
     Info = info;
     InfoChanged?.Invoke(info);
 }