Example #1
0
        /// <summary>
        /// Update Responsibility in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comboBoxResponsibility_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (!loadedUI)
                {
                    return;
                }

                UIElement uiElement = e.OriginalSource as UIElement;
                if (uiElement.IsMouseCaptured)
                {
                    DataGridRow row = WPFUtil.FindVisualParent <DataGridRow>(uiElement);
                    if (null != row)
                    {
                        Component component = row.Item as Component;
                        bool      updated   = BCFDBWriter.BCFDBWriter.UpdateComponent(component);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
Example #2
0
        /// <summary>
        /// Change the selected entry of the color
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonColor_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataGridRow row = WPFUtil.FindVisualParent <DataGridRow>(e.OriginalSource as UIElement);
                if (null != row)
                {
                    RevitExtension selectedExt = row.Item as RevitExtension;
                    if (null != selectedExt)
                    {
                        if (selectedExt.Guid == Guid.Empty.ToString())
                        {
                            return;
                        }

                        WinForm.ColorDialog colorDialog = new WinForm.ColorDialog();
                        if (colorDialog.ShowDialog() == WinForm.DialogResult.OK)
                        {
                            System.Drawing.Color selectedColor = colorDialog.Color;
                            Button button = e.OriginalSource as Button;
                            if (null != button)
                            {
                                int index = extInfo.Extensions.IndexOf(selectedExt);
                                extInfo.Extensions[index].Color[0] = selectedColor.R;
                                extInfo.Extensions[index].Color[1] = selectedColor.G;
                                extInfo.Extensions[index].Color[2] = selectedColor.B;
                                button.Background = new SolidColorBrush(Color.FromRgb(selectedColor.R, selectedColor.G, selectedColor.B));
                            }
                            colorChanged = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }