예제 #1
0
        /// <summary>
        /// Edit edit descriptive attribute
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DescAttributeEditButton_Click(object sender, RoutedEventArgs e)
        {
            var    pair      = (KeyValuePair <string, string>)((Button)sender).Tag;
            string key       = pair.Key;
            string prevValue = pair.Value;

            var EditAttributeWindow = new EditAttributeWindow()
            {
                Attribute = key,
                Value     = prevValue.ToString(),
                IsNumeric = false
            };

            if (EditAttributeWindow.ShowDialog() == true)
            {
                if (EditAttributeWindow.ApplyAll)
                {
                    foreach (var edge in graph.Impl.AllEdges.Values)
                    {
                        edge.DescriptiveAttributes[key] = EditAttributeWindow.Value;
                    }
                }
                else
                {
                    this.MainCanvas.SelectedEdge.Impl.DescriptiveAttributes[key] = EditAttributeWindow.Value;
                }
                PopulateAttributesPanel(this.MainCanvas.SelectedEdge);
            }
        }
예제 #2
0
        /// <summary>
        /// Edit edit numeric attribute
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NumAttributeEditButton_Click(object sender, RoutedEventArgs e)
        {
            var    pair      = (KeyValuePair <string, double>)((Button)sender).Tag;
            string key       = pair.Key;
            double prevValue = pair.Value;

            var EditAttributeWindow = new EditAttributeWindow()
            {
                Attribute = key,
                Value     = prevValue.ToString(),
                IsNumeric = true
            };

            if (EditAttributeWindow.ShowDialog() == true)
            {
                double newValue = Double.TryParse(EditAttributeWindow.Value, out newValue) ? newValue : prevValue;

                if (EditAttributeWindow.ApplyAll)
                {
                    foreach (var edge in graph.Impl.AllEdges.Values)
                    {
                        edge.NumericAttributes[key] = newValue;
                    }
                }
                else
                {
                    this.MainCanvas.SelectedEdge.Impl.NumericAttributes[key] = newValue;
                }

                PopulateAttributesPanel(this.MainCanvas.SelectedEdge);
            }
        }