Пример #1
0
        void StopEditing(IEditableValue ev)
        {
            if (ev == null)
            {
                return;
            }
            Debug.Assert(editing);
            editing = false;

            if (!canceled)
            {
                var newText = textBox.Text;
                if (newText != originalText)
                {
                    string error;
                    try {
                        error = ev.SetValueAsText(newText);
                    }
                    catch (Exception ex) {
                        error = string.Format(dnSpy_Debugger_Resources.LocalsEditValue_Error_CouldNotWriteNewValue, ex.Message);
                    }
                    if (!string.IsNullOrEmpty(error))
                    {
                        Shared.App.MsgBox.Instance.Show(error);
                    }
                }
            }

            ev.IsEditingValue = false;
            RestoreControls();
        }
Пример #2
0
        void StopEditing(IEditableValue ev)
        {
            if (ev == null)
            {
                return;
            }
            Debug.Assert(editing);
            editing = false;

            if (!canceled)
            {
                var newText = textBox.Text;
                if (newText != originalText)
                {
                    string error;
                    try {
                        error = ev.SetValueAsText(newText);
                    }
                    catch (Exception ex) {
                        error = string.Format("Could not set value: {0}", ex.Message);
                    }
                    if (!string.IsNullOrEmpty(error))
                    {
                        MainWindow.Instance.ShowMessageBox(error);
                    }
                }
            }

            ev.IsEditingValue = false;
            RestoreControls();
        }
Пример #3
0
 void UninstallHooks(IEditableValue ev)
 {
     if (ev == null)
     {
         return;
     }
     ev.PropertyChanged -= IEditableValue_PropertyChanged;
 }
Пример #4
0
        public GroupFlexpressionDefinition(string groupName,
                                           IEditableValue <IFlexpression> contentContainer, bool isSealed = false)
        {
            Guard.ArgNotNull(contentContainer, nameof(contentContainer));

            IsSealed         = isSealed;
            GroupName        = groupName;
            ContentContainer = contentContainer;
        }
Пример #5
0
        void StartEditing(IEditableValue ev)
        {
            Debug.Assert(!editing);

            editing            = true;
            canceled           = false;
            content.Visibility = Visibility.Collapsed;
            textBox.Visibility = Visibility.Visible;
            textBox.Text       = originalText = ev.GetValueAsText() ?? string.Empty;
            textBox.SelectAll();
            textBox.Focus();
        }
Пример #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="xmlDoc">CreateElement用</param>
        /// <param name="dataGridElement">追加先親ノード</param>
        /// <param name="slot">追加するノード</param>
        /// <param name="sb">属性値</param>
        private void _Recursively(XmlDocument xmlDoc, XmlElement dataGridElement, IEditableValue slot, StringBuilder sb)
        {
            var bindableName = slot.BindableName;

            sb.Append("." + bindableName);

            var groupSlot = slot.Value as ObservableCollection<IEditableValue>;
            // グループ用スロットの場合
            if (null != groupSlot)
            {
                // .{BindableName} Recursibly
                // Value分再帰
                foreach (var childSlot in groupSlot)
                {
                    StringBuilder childrenSb = new StringBuilder(sb.ToString());
                    _Recursively(xmlDoc, dataGridElement, childSlot, childrenSb);
                }
            }
            // パラメータスロットの場合 sbの中身は {Binding Path=Tag.<GroupBindableName>.<GroupBindableName>
            else
            {
                // 自身のDispNameを結合してヘッダー属性値を作成
                var headerAttribute = string.Format("{0}.DispName, Source={{StaticResource {1}}}}}", sb.ToString(), ProxyName);
                // Tagを外したValueバインド用属性の頭
                var bindingAttributePrefix = sb.Replace("{Binding Path=Tag.", "{Binding Path=").ToString();
                var type = slot.Type;
                switch (type)
                {
                    case (int)GX_META_INFO_TYPE.INT8:
                    case (int)GX_META_INFO_TYPE.INT16:
                    case (int)GX_META_INFO_TYPE.INT32:
                    case (int)GX_META_INFO_TYPE.INT64:
                    case (int)GX_META_INFO_TYPE.UINT8:
                    case (int)GX_META_INFO_TYPE.UINT16:
                    case (int)GX_META_INFO_TYPE.UINT32:
                    case (int)GX_META_INFO_TYPE.UINT64:
                    case (int)GX_META_INFO_TYPE.FLOAT32:
                    case (int)GX_META_INFO_TYPE.FLOAT64:
                    case (int)GX_META_INFO_TYPE.STRINGW:
                    case (int)GX_META_INFO_TYPE.VECTOR2AL:
                    case (int)GX_META_INFO_TYPE.VECTOR3AL:
                    case (int)GX_META_INFO_TYPE.VECTOR4AL:
                    case (int)GX_META_INFO_TYPE.COLOR32:
                        {
                            var element = xmlDoc.CreateElement(TextColumnExName);

                            element.SetAttribute("Header", headerAttribute);

                            switch (type)
                            {
                                case (int)GX_META_INFO_TYPE.VECTOR2AL:
                                case (int)GX_META_INFO_TYPE.VECTOR3AL:
                                case (int)GX_META_INFO_TYPE.VECTOR4AL:
                                    element.SetAttribute("Binding", string.Format("{0}.Value, Mode=TwoWay, UpdateSourceTrigger=LostFocus, Converter={{StaticResource {1}}}}}", sb.ToString(), VectorToStringConverterKey));
                                    break;
                                case (int)GX_META_INFO_TYPE.COLOR32:
                                    element.SetAttribute("Binding", string.Format("{0}.Value, Mode=TwoWay, UpdateSourceTrigger=LostFocus, Converter={{StaticResource {1}}}}}", sb.ToString(), ColorToStringConverterKey));
                                    break;
                                default:
                                    element.SetAttribute("Binding", string.Format("{0}.Value, Mode=TwoWay, UpdateSourceTrigger=LostFocus}}", sb.ToString()));
                                    break;
                            }
                            dataGridElement.AppendChild(element);
                        }
                        break;
                    case (int)GX_META_INFO_TYPE.BOOL:
                        {
                            var element = xmlDoc.CreateElement(CheckBoxColumnName);
                            element.SetAttribute("Header", headerAttribute);
                            {
                                var templateElement = xmlDoc.CreateElement(string.Format("{0}.CellTemplate", CheckBoxColumnName));
                                {
                                    var dataTemplateElement = xmlDoc.CreateElement("DataTemplate");
                                    {
                                        var checkBoxElement = xmlDoc.CreateElement("CheckBox");

                                        checkBoxElement.SetAttribute("IsChecked", string.Format("{0}.Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}}", sb.ToString()));

                                        dataTemplateElement.AppendChild(checkBoxElement);
                                    }
                                    templateElement.AppendChild(dataTemplateElement);
                                }
                                element.AppendChild(templateElement);
                            }
                            dataGridElement.AppendChild(element);

                        }
                        break;

                }
            }
        }
Пример #7
0
		void UninstallHooks(IEditableValue ev) {
			if (ev == null)
				return;
			ev.PropertyChanged -= IEditableValue_PropertyChanged;
		}
Пример #8
0
		void StopEditing(IEditableValue ev) {
			if (ev == null)
				return;
			Debug.Assert(editing);
			editing = false;

			if (!canceled) {
				var newText = textBox.Text;
				if (newText != originalText) {
					string error;
					try {
						error = ev.SetValueAsText(newText);
					}
					catch (Exception ex) {
						error = string.Format(dnSpy_Debugger_Resources.LocalsEditValue_Error_CouldNotWriteNewValue, ex.Message);
					}
					if (!string.IsNullOrEmpty(error))
						Shared.App.MsgBox.Instance.Show(error);
				}
			}

			ev.IsEditingValue = false;
			RestoreControls();
		}
Пример #9
0
		void StartEditing(IEditableValue ev) {
			Debug.Assert(!editing);

			editing = true;
			canceled = false;
			content.Visibility = Visibility.Collapsed;
			textBox.Visibility = Visibility.Visible;
			textBox.Text = originalText = ev.GetValueAsText() ?? string.Empty;
			textBox.SelectAll();
			textBox.Focus();
		}
Пример #10
0
		void StopEditing(IEditableValue ev) {
			if (ev == null)
				return;
			Debug.Assert(editing);
			editing = false;

			if (!canceled) {
				var newText = textBox.Text;
				if (newText != originalText) {
					string error;
					try {
						error = ev.SetValueAsText(newText);
					}
					catch (Exception ex) {
						error = string.Format("Could not set value: {0}", ex.Message);
					}
					if (!string.IsNullOrEmpty(error))
						MainWindow.Instance.ShowMessageBox(error);
				}
			}

			ev.IsEditingValue = false;
			RestoreControls();
		}