Пример #1
0
 public static void ResolveThemeColorData(ParsingContext context, ColorDefinition in_cd, bool indexOnly)
 {
     if ( context != null && 
          context.ThemeTable != null &&
         !String.IsNullOrEmpty(in_cd.ThemeName))
     {
         foreach (ColorDefinition cd in context.ThemeTable.Colors)
         {
             if (in_cd.ThemeName == cd.ThemeName)
             {
                 if (indexOnly)
                 {
                     in_cd.ColourTableIndex = cd.ColourTableIndex;
                 }
                 else
                 {
                     in_cd.ColourTableIndex = cd.ColourTableIndex;
                     in_cd.RGBColor = cd.RGBColor;
                     in_cd.Red = cd.Red;
                     in_cd.Green = cd.Green;
                     in_cd.Blue = cd.Blue;
                 }
                 break;
             }
         }
     }
 }
Пример #2
0
        public void GetDrawingColorMap()
        {
            var map = ColorDefinition.GetDrawingColorMap();

            Assert.AreEqual(141, map.Count);
            Assert.AreEqual(System.Drawing.Color.AliceBlue, map["AliceBlue"]);
        }
Пример #3
0
        public void UpdateBatchColorDefinition()
        {
            var cd = new ColorDefinition(COLORS_DEFINITION_DARK_TEST_FILE);
            var batchColorDefinition = cd.GetFileColorDefinitionSet(FileExtensionSupported.BAT);

            foreach (var b in batchColorDefinition)
            {
                b.Value.Italic    = true;
                b.Value.Bold      = true;
                b.Value.ColorName = "NavajoWhite";
            }
            cd.SetFileColorDefinitionSet(FileExtensionSupported.BAT, batchColorDefinition);

            var newFileName = cd.FileName + ".json";

            cd.Save(newFileName);

            var cd2 = new ColorDefinition(newFileName);

            batchColorDefinition = cd2.GetFileColorDefinitionSet(FileExtensionSupported.BAT);

            foreach (var b in batchColorDefinition)
            {
                DS.Assert.ValueTypeProperties(b.Value, new { ColorName = "NavajoWhite", Bold = true, Italic = true });
            }
            File.Delete(newFileName);
        }
Пример #4
0
        public void GetAvailableThemes()
        {
            var themes = ColorDefinition.GetAvailableThemes(TestFolder);

            Assert.AreEqual(2, themes.Count);
            Assert.IsTrue(themes.Include(DS.List("Dark", "Light")));
        }
Пример #5
0
 public ColorWithValue(ColorDefinition color)
 {
     Color = Color.Parse(color.Hex);
     Index = color.Index;
     Name  = color.Name;
     Hex   = color.Hex;
 }
Пример #6
0
        private void buttonDeleteRes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (null != dataGridResponsibility.SelectedItem)
                {
                    ColorDefinition colorDefinition = (ColorDefinition)dataGridResponsibility.SelectedItem;
                    string          oldName         = colorDefinition.ParameterValue;

                    dataGridResponsibility.ItemsSource = null;
                    for (int i = 0; i < responsibleDefinitions.Count; i++)
                    {
                        if (responsibleDefinitions[i].ParameterValue == oldName)
                        {
                            responsibleDefinitions.RemoveAt(i);
                        }
                    }
                    dataGridResponsibility.ItemsSource = responsibleDefinitions;

                    bool updated = BCFParser.UpdateColorSheet(responsibleScheme, colorDefinition, null, ModifyItem.Delete, colorSheetId);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to delete Responsibility item.\n" + ex.Message, "Delete Responsibility Item", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #7
0
        public void GetColor()
        {
            var cd = new ColorDefinition(COLORS_DEFINITION_DARK_TEST_FILE);

            Assert.AreEqual("italic.MediumSpringGreen", cd.GetColor(FileExtensionSupported.BAT, "Comment"));
            Assert.AreEqual("bold.LightBlue", cd.GetColor(FileExtensionSupported.BAT, "Keyword"));
            Assert.AreEqual("NavajoWhite", cd.GetColor(FileExtensionSupported.BAT, "Default"));
        }
Пример #8
0
    public void ExternalColorDidChange(string json)
    {
        ColorDefinition definition = ColorDefinition.OfJson(json);

        ObservableColorOfKey(definition.FullKey).SetValue(
            new Color(definition.R, definition.G, definition.B)
            );
    }
Пример #9
0
        public void GetMediaColorMap()
        {
            var map = ColorDefinition.GetMediaColorMap();

            Assert.AreEqual(141, map.Count);

            Assert.AreEqual(System.Windows.Media.Colors.AliceBlue, map["AliceBlue"]);
        }
Пример #10
0
 public ElementProperties(Element element, ColorDefinition colorDef)
 {
     revitElement     = element;
     elementId        = element.Id;
     elementIdInteger = element.Id.IntegerValue;
     definition       = colorDef;
     ifcGuid          = GUIDUtil.CreateGUID(revitElement);
 }
Пример #11
0
 public ColorDefinition(ColorDefinition definition)
 {
     this.ParameterValue = definition.ParameterValue;
     this.MinimumValue   = definition.MinimumValue;
     this.MaximumValue   = definition.MaximumValue;
     this.Color          = definition.Color;
     this.UserDefined    = definition.UserDefined;
 }
    public static void addRenderInformation(RenderLayoutPlugin rPlugin)
    {
        if (rPlugin == null)
        {
            Console.WriteLine("could not add render information!");
            Environment.Exit(4);
        }

        LocalRenderInformation rInfo = rPlugin.createLocalRenderInformation();

        rInfo.setId("info");
        rInfo.setName("Example Render Information");
        rInfo.setProgramName("RenderInformation Examples");
        rInfo.setProgramVersion("1.0");

        // add some colors
        ColorDefinition color = rInfo.createColorDefinition();

        color.setId("black");
        color.setColorValue("#000000");

        color = rInfo.createColorDefinition();
        color.setId("silver");
        color.setColorValue("#c0c0c0");

        color = rInfo.createColorDefinition();
        color.setId("white");
        color.setColorValue("#FFFFFF");

        // add a linear gradient from black to white to silver
        LinearGradient gradient = rInfo.createLinearGradientDefinition();

        gradient.setId("simpleGradient");
        gradient.setPoint1(new RelAbsVector(), new RelAbsVector());
        gradient.setPoint2(new RelAbsVector(0, 100), new RelAbsVector(0, 100));

        GradientStop stop = gradient.createGradientStop();

        stop.setOffset(new RelAbsVector());
        stop.setStopColor("white");

        stop = gradient.createGradientStop();
        stop.setOffset(new RelAbsVector(0, 100));
        stop.setStopColor("silver");

        // add a species style that represents them as ellipses with the gradient above
        Style style = rInfo.createStyle("ellipseStyle");

        style.getGroup().setFillColor("simpleGradient");
        style.getGroup().setStroke("black");
        style.getGroup().setStrokeWidth(2.0);
        style.addType("SPECIESGLYPH");

        Ellipse ellipse = style.getGroup().createEllipse();

        ellipse.setCenter2D(new RelAbsVector(0, 50), new RelAbsVector(0, 50));
        ellipse.setRadii(new RelAbsVector(0, 50), new RelAbsVector(0, 50));
    }
Пример #13
0
        void SetTextShadow(ColorDefinition textShadowColor)
        {
            if (textShadowColor == null)
            {
                return;
            }

            this.SetShadowLayer(1, 0, 1, textShadowColor.ConvertToColor());
        }
Пример #14
0
        private void SetColor(string colorId)
        {
            ColorDefinition colorDef = _Service.Colors.Get().Execute().Calendar[colorId];
            String          color    = colorDef.Background;
            int             r        = Int32.Parse(color.Substring(1, 2), System.Globalization.NumberStyles.HexNumber);
            int             g        = Int32.Parse(color.Substring(3, 2), System.Globalization.NumberStyles.HexNumber);
            int             b        = Int32.Parse(color.Substring(5, 2), System.Globalization.NumberStyles.HexNumber);

            Color = Color.FromArgb(r, g, b);
        }
Пример #15
0
        public static Brush GetBackgroundBrush(this IEditorFormatMap self, ColorDefinition definition,
                                               byte alpha = 0xff)
        {
            var prop  = self.GetProperties(definition.ResourceName);
            var color = (prop?[EditorFormatDefinition.BackgroundColorId] as Color?
                         ?? definition.BackgroundColor
                         ?? Colors.Transparent).SetAlpha(alpha);

            return(new SolidColorBrush(color).FreezeAnd());
        }
Пример #16
0
        public virtual void DrawToGraphics(Graphics graphics)
        {
            Pen pen = Pens.Black;
            switch (this.CurrentState)
            {
                case ItemState.Free:
                    pen = new Pen(ColorDefinition.GetColorWhenFree());
                    break;

                case ItemState.Hover:
                    pen = new Pen(ColorDefinition.GetColorWhenHover());
                    break;

                case ItemState.Selected:
                    pen = new Pen(ColorDefinition.GetColorWhenSelected());
                    break;

                default:
                    break;
            } // switch

            setLinkKind(pen);

            List<PointF> tempNails = new List<PointF>();
            tempNails.Add(this.GetStartingPoint());
            foreach (NailItem nail in this.nails)
                tempNails.Add(nail.Center());
            tempNails.Add(this.GetEndPoint());

            float R = NailItem.R;
            if (this.CurrentState == ItemState.Free)
                R = NailItem.R + 5;

            PointF[] points = new PointF[3];
            PointF firstNail = PointF.Empty;
            firstNail = tempNails[0];
            for (int i = 0; i < tempNails.Count - 1; i++)
            {
                points[1] = tempNails[i + 1];
                points[0] = GraphUltility.FindPointByDistance(points[1], firstNail, R);
                graphics.DrawLine(pen, firstNail, points[0]);

                if (i + 2 < tempNails.Count)
                {
                    points[2] = GraphUltility.FindPointByDistance(points[1], tempNails[i + 2], R);
                    firstNail = points[2];

                    //Make the intersection curved
                    if (this.CurrentState == ItemState.Free)
                        graphics.DrawBezier(pen, points[0], points[1], points[1], points[2]);
                }
            }

            DrawRouteWithBigArrow(graphics, pen, firstNail, tempNails[tempNails.Count - 1]);
        }
Пример #17
0
        public void DisplayElement(int index)
        {
            try
            {
                if (elementList.Count > 0)
                {
                    ElementProperties ep = elementList[index];
                    selElementProperties     = ep;
                    m_handler.CurrentElement = selElementProperties;

                    if (!string.IsNullOrEmpty(ep.ElementName))
                    {
                        textBoxRevit.Text = ep.ElementName;
                    }
                    else
                    {
                        textBoxRevit.Text = "Element Not Found - " + ep.ElementId.ToString();
                    }

                    freezeHandler = true;
                    if (comboBoxAction.HasItems)
                    {
                        for (int i = 0; i < comboBoxAction.Items.Count; i++)
                        {
                            ColorDefinition definition = (ColorDefinition)comboBoxAction.Items[i];
                            if (definition.ParameterValue == selElementProperties.Action)
                            {
                                comboBoxAction.SelectedIndex = i; break;
                            }
                        }
                    }

                    if (comboBoxResponsible.HasItems)
                    {
                        for (int i = 0; i < comboBoxResponsible.Items.Count; i++)
                        {
                            ColorDefinition definition = (ColorDefinition)comboBoxResponsible.Items[i];
                            if (definition.ParameterValue == selElementProperties.ResponsibleParty)
                            {
                                comboBoxResponsible.SelectedIndex = i; break;
                            }
                        }
                    }
                    freezeHandler = false;
                }
                else if (elementList.Count == 0)
                {
                    textBoxRevit.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to display the current element.\n" + ex.Message, "Display Element", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public StatusItemWindow(ColorDefinition definition, ColorSource source, NewOrEdit neworedit)
        {
            colorDefinition = definition;
            newOrEdit       = neworedit;
            InitializeComponent();
            this.Title      = newOrEdit.ToString() + " " + source.ToString() + " Item";
            groupBox.Header = source.ToString();

            textBoxName.Text       = colorDefinition.ParameterValue;
            buttonColor.Background = colorDefinition.BackgroundColor;
        }
Пример #19
0
        public void LoadColorDefinition()
        {
            var cd = new ColorDefinition(COLORS_DEFINITION_DARK_TEST_FILE);

            Assert.AreEqual("Dark", cd.Theme);

            var fileExtensions = cd.GetFileExtensions();

            Assert.AreEqual(5, fileExtensions.Count);

            Assert.IsTrue(fileExtensions.Include(DS.List("JSON", "INI", "BAT", "LOG", "TXT")));
        }
Пример #20
0
 public static Boolean isColorID(string strokeText, System.Collections.Generic.List <ColorDefinition> definitions)
 {
     for (int ii = 0; ii < definitions.Count; ii++)
     {
         ColorDefinition def = definitions[ii];
         if (def.ID.Equals(strokeText))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #21
0
 public ColorDefinition(ColorDefinition definition)
 {
     this.ParameterValue  = definition.ParameterValue;
     this.MinimumValue    = definition.MinimumValue;
     this.MaximumValue    = definition.MaximumValue;
     this.Color[0]        = definition.Color[0];
     this.Color[1]        = definition.Color[1];
     this.Color[2]        = definition.Color[2];
     this.RGB             = definition.RGB;
     this.InUse           = definition.InUse;
     this.BackgroundColor = definition.BackgroundColor;
     this.UserDefined     = definition.UserDefined;
 }
Пример #22
0
        private void buttonSettings_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                StatusWindow statusWindow = new StatusWindow(schemeInfo, bcfColorSchemeId);
                if (statusWindow.ShowDialog() == true)
                {
                    schemeInfo                = statusWindow.SchemeInfo;
                    actionDefinitons          = statusWindow.ActionDefinitions;
                    responsibilityDefinitions = statusWindow.ResponsibleDefinitions;
                    statusWindow.Close();

                    comboBoxAction.ItemsSource      = null;
                    comboBoxResponsible.ItemsSource = null;

                    comboBoxAction.ItemsSource      = actionDefinitons;
                    comboBoxResponsible.ItemsSource = responsibilityDefinitions;

                    freezeHandler = true;
                    if (null != selElementProperties)
                    {
                        for (int i = 0; i < comboBoxAction.Items.Count; i++)
                        {
                            ColorDefinition definition = (ColorDefinition)comboBoxAction.Items[i];
                            if (definition.ParameterValue == selElementProperties.Action)
                            {
                                comboBoxAction.SelectedIndex = i;
                            }
                        }

                        for (int i = 0; i < comboBoxResponsible.Items.Count; i++)
                        {
                            ColorDefinition definition = (ColorDefinition)comboBoxResponsible.Items[i];
                            if (definition.ParameterValue == selElementProperties.ResponsibleParty)
                            {
                                comboBoxResponsible.SelectedIndex = i;
                            }
                        }
                    }
                    freezeHandler = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to set color schemes.\n" + ex.Message, "Color Settings", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #23
0
        public void UpdateModel(string fileExtension)
        {
            if (fileExtension == null)
            {
                fileExtension = this.cboFileExtension.Text;
            }

            if (String.IsNullOrEmpty(fileExtension))
            {
                return; // This should not happens, but I guess it does
            }
            var fileColorDefinition = TextHighlighterConfigApi.GlobalColorDefinition
                                      .GetFileColorDefinitionSet(ColorDefinition.ToFileExtensionSupported(fileExtension))
                                      .PopulateFromListView(this.lvColor);

            TextHighlighterConfigApi.GlobalColorDefinition
            .SetFileColorDefinitionSet(ColorDefinition.ToFileExtensionSupported(fileExtension), fileColorDefinition);
        }
Пример #24
0
        public override void DrawToGraphics(Graphics graphics)
        {
            string label = Value.ToString();

            if (!string.IsNullOrEmpty(label))
            {
                Color color = Color.Black;
                switch (this.CurrentState)
                {
                case ItemState.Hover:
                    color = ColorDefinition.GetColorWhenHover();
                    break;

                case ItemState.Selected:
                    color = ColorDefinition.GetColorWhenSelected();
                    break;

                default:
                    break;
                } // switch

                if (this.CurrentState == ItemState.Free)
                {
                    color = ColorDefinition.GetColorOfName();
                }

                //Shorten label
                int allowedLength = 50;
                if (label.Length > allowedLength)
                {
                    label = label.Substring(0, allowedLength) + "...";
                }

                float width  = graphics.MeasureString(label, this.TitleFont).Width;
                float height = this.TitleFont.Size + 5;

                RectangleF rect = new RectangleF(X, Y, width, height);
                graphics.DrawString(label, this.TitleFont, new SolidBrush(color), rect);
                if (Math.Abs(this.Width - width) > 15)
                {
                    this.Width = width;
                }
            }
        }
    public static void print_render_info(RenderInformationBase info)
    {
        if (info.isSetId())
        {
            Console.WriteLine("  Id: " + info.getId());
        }
        if (info.isSetName())
        {
            Console.WriteLine("  Name: " + info.getName());
        }
        if (info.isSetProgramName())
        {
            Console.WriteLine("  Program Name: " + info.getProgramName());
        }
        if (info.isSetProgramVersion())
        {
            Console.WriteLine("  Program Version: " + info.getProgramVersion());
        }
        if (info.isSetBackgroundColor())
        {
            Console.WriteLine("  Background color: " + info.getBackgroundColor());
        }

        Console.WriteLine("\nColor Definitions:");
        for (int j = 0; j < info.getNumColorDefinitions(); ++j)
        {
            ColorDefinition color = info.getColorDefinition(j);
            Console.WriteLine("\tcolor: " + j.ToString() +
                              " id: " + color.getId() +
                              " color: " + color.getValue());
        }

        Console.WriteLine("\nGradientDefinitions: ");
        for (int j = 0; j < info.getNumGradientDefinitions(); ++j)
        {
            GradientBase grad = info.getGradientDefinition(j);

            print_gradient_definition(grad);
        }

        // similarly for the remaining elements
        Console.WriteLine("\nNumber of Line Endings: {0}", info.getNumLineEndings());
    }
Пример #26
0
        public static void UpdateColorDefinitionRGB(ColorDefinition in_cd, bool isForeground)
        {
            if (!String.IsNullOrEmpty(in_cd.RGBColor))
            {
                if (in_cd.RGBColor == "auto")
                {
                    if (isForeground)
                        in_cd.RGBColor = "000000";
                    else
                        in_cd.RGBColor = "FFFFFF";
                }

                string r = in_cd.RGBColor.Substring(0, 2);
                string g = in_cd.RGBColor.Substring(2, 2);
                string b = in_cd.RGBColor.Substring(4, 2);
                in_cd.Red = Byte.Parse(r, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture);
                in_cd.Green = Byte.Parse(g, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture);
                in_cd.Blue = Byte.Parse(b, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture);
            }
        }
Пример #27
0
        public void LoadColorDefinitionVerifyBatchColorDefinition()
        {
            var cd = new ColorDefinition(COLORS_DEFINITION_DARK_TEST_FILE);

            var batchColorDefinition = cd.GetFileColorDefinitionSet(FileExtensionSupported.BAT);

            Assert.AreEqual(10, batchColorDefinition.Count);
            Assert.IsTrue(batchColorDefinition.Keys.ToList().Include(DS.List("Keyword", "Comment", "Flag", "Label", "EnvVar", "Redirection", "Punctuation", "Parameter", "String", "Default")));

            DS.Assert.ValueTypeProperties(batchColorDefinition["Keyword"], new { ColorName = "LightBlue", Bold = true, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Comment"], new { ColorName = "MediumSpringGreen", Bold = false, Italic = true });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Flag"], new { ColorName = "Turquoise", Bold = false, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Label"], new { ColorName = "DarkOrange", Bold = false, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["EnvVar"], new { ColorName = "DarkSalmon", Bold = true, Italic = true });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Redirection"], new { ColorName = "Red", Bold = false, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Punctuation"], new { ColorName = "Red", Bold = false, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Parameter"], new { ColorName = "DarkKhaki", Bold = false, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["String"], new { ColorName = "LightSkyBlue", Bold = false, Italic = false });
            DS.Assert.ValueTypeProperties(batchColorDefinition["Default"], new { ColorName = "NavajoWhite", Bold = false, Italic = false });
        }
    public static void Report(DateTime date, string name, string description, int minutes, string colorID = "0")
    {
        LoadCredential();

        if (service != null)
        {
            try
            {
                Colors          cs = new Colors();
                ColorDefinition c  = new ColorDefinition();

                Event e = new Event();
                e.Summary     = name;
                e.Description = description;
                e.ColorId     = colorID;

                e.Location = RecordManager.GetRecord(Const.GoogleCalendarConfig, Const.Google_Location, "XXX");

                EventDateTime start = new EventDateTime();
                start.DateTime = date;
                start.TimeZone = RecordManager.GetRecord(Const.GoogleCalendarConfig, Const.Google_TimeZone, "Asia/Shanghai");
                e.Start        = start;

                EventDateTime end = new EventDateTime();
                end.DateTime = date.AddMinutes(minutes);
                end.TimeZone = RecordManager.GetRecord(Const.GoogleCalendarConfig, Const.Google_TimeZone, "Asia/Shanghai");
                e.End        = end;

                String calendarId = "primary";
                service.Events.Insert(e, calendarId).Execute();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
        else
        {
            MainWindow.Notify("ERROR: Google 服务未启动");
        }
    }
Пример #29
0
        public static void AddColor(string name, float r, float g, float b)
        {
            Color custom = new Color(r / 255f, g / 255f, b / 255f);

            ColorDefinition color = new ColorDefinition(name, custom);

            string[] saveColor = { "\n" + name, "" + r, "" + g, "" + b };
            if (!System.IO.File.Exists(@"..\data\CustomColors.txt"))
            {
                File.Create(@"..\data\CustomColors.txt");
            }

            System.IO.File.AppendAllLines(@"..\data\CustomColors.txt", saveColor);

            ColorDefinition customDef = new ColorDefinition(name, custom);

            if (!_statColorMap.Keys.Contains(name.ToLowerInvariant()))
            {
                _statColorMap.Add(name.ToLowerInvariant(), customDef);
            }
        }
Пример #30
0
        private void buttonAddRes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ColorDefinition colorDefinition = new ColorDefinition();
                byte[]          colorBytes      = new byte[3];
                colorBytes[0]         = (byte)random.Next(256);
                colorBytes[1]         = (byte)random.Next(256);
                colorBytes[2]         = (byte)random.Next(256);
                colorDefinition.Color = colorBytes;

                System.Windows.Media.Color windowColor = System.Windows.Media.Color.FromRgb(colorDefinition.Color[0], colorDefinition.Color[1], colorDefinition.Color[2]);
                colorDefinition.BackgroundColor = new SolidColorBrush(windowColor);

                var names = from name in responsibleDefinitions select name.ParameterValue;

                StatusItemWindow itemWindow = new StatusItemWindow(colorDefinition, ColorSource.Responsibility, NewOrEdit.New);
                if (names.Count() > 0)
                {
                    itemWindow.DefinitionNames = names.ToList();
                }

                if (itemWindow.ShowDialog() == true)
                {
                    ColorDefinition newDefinition = itemWindow.SelColorDefinition;
                    itemWindow.Close();

                    dataGridResponsibility.ItemsSource = null;
                    responsibleDefinitions.Add(newDefinition);
                    responsibleDefinitions             = responsibleDefinitions.OrderBy(o => o.ParameterValue).ToList();
                    dataGridResponsibility.ItemsSource = responsibleDefinitions;

                    bool updated = BCFParser.UpdateColorSheet(responsibleScheme, null, newDefinition, ModifyItem.Add, colorSheetId);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to add Responsibility item.\n" + ex.Message, "Add Responsibility Item", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #31
0
        private void comboBoxResponsible_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (null != comboBoxResponsible.SelectedItem && freezeHandler == false)
                {
                    ColorDefinition selectedResponsible = (ColorDefinition)comboBoxResponsible.SelectedItem;

                    if (null != selectedBCF && null != selectedIssue && null != selElementProperties)
                    {
                        selElementProperties.ResponsibleParty = selectedResponsible.ParameterValue;

                        if (bcfDictionary.ContainsKey(selectedBCF.MarkupFileId))
                        {
                            if (bcfDictionary[selectedBCF.MarkupFileId].ContainsKey(selectedIssue.IssueId))
                            {
                                if (bcfDictionary[selectedBCF.MarkupFileId][selectedIssue.IssueId].ElementDictionary.ContainsKey(selElementProperties.ElementId))
                                {
                                    bcfDictionary[selectedBCF.MarkupFileId][selectedIssue.IssueId].ElementDictionary.Remove(selElementProperties.ElementId);
                                    bcfDictionary[selectedBCF.MarkupFileId][selectedIssue.IssueId].ElementDictionary.Add(selElementProperties.ElementId, selElementProperties);
                                }
                            }
                        }

                        bool updatedSheet = BCFParser.UpdateElementProperties(selElementProperties, BCFParameters.BCF_Responsibility, selectedBCF.ViewpointFileId);

                        m_handler.CurrentElement = selElementProperties;
                        m_handler.Request.Make(RequestId.UpdateResponsibility);
                        m_event.Raise();
                        SetFocus();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to set responsibility itme.\n" + ex.Message, "Set Responsibility Items", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #32
0
 public ColorScheme(ColorScheme source)
 {
     this.SchemeName        = source.SchemeName;
     this.Categories        = source.Categories;
     this.SelectedParamInfo = source.SelectedParamInfo;
     this.ParameterName     = source.ParameterName;
     this.ColorDefinitions  = new List <ColorDefinition>();
     foreach (ColorDefinition colorDefinition in source.ColorDefinitions)
     {
         ColorDefinition cd = new ColorDefinition(colorDefinition);
         this.ColorDefinitions.Add(cd);
     }
     this.CustomColorDefinitions = source.CustomColorDefinitions;
     this.FilterRules            = source.FilterRules;
     this.FilteredElements       = source.FilteredElements;
     this.SchemeId         = source.SchemeId;
     this.DefinitionBy     = source.DefinitionBy;
     this.PresetRange      = source.PresetRange;
     this.NumberOfRange    = source.NumberOfRange;
     this.SelectedViewInfo = source.SelectedViewInfo;
     this.ViewName         = source.ViewName;
     this.IncludeLinks     = source.IncludeLinks;
 }
Пример #33
0
        private void UpdateCurrentColorDefinition()
        {
            if (m_currentCD == null)
                m_currentCD = new ColorDefinition();

            if (shouldAdd)
            {
                m_dataObject.Colors.Add(m_currentCD);
                shouldAdd = false;
                m_currentCD = new ColorDefinition();
            }
        }