Exemplo n.º 1
0
 public Filament(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color, string codeStr, FilamentConstants.Branding brand)
 {
     this.type    = type;
     this.color   = color;
     this.codeStr = codeStr;
     this.brand   = brand;
 }
Exemplo n.º 2
0
 public int GetFilamentTemperature(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum colors)
 {
     foreach (var customValue in filamentDictionary.CustomValues)
     {
         if (customValue.Key.type == type && customValue.Key.color == colors)
         {
             return(customValue.Value.temperature);
         }
     }
     return(FilamentConstants.Temperature.Default(type));
 }
Exemplo n.º 3
0
        public void RemoveCustomTemperature(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color)
        {
            var key = new FilamentProfile.TypeColorKey(type, color);

            if (!custom_filament_values.ContainsKey(key))
            {
                return;
            }

            custom_filament_values.TryRemove(key, out FilamentProfile.CustomOptions customOptions);
        }
Exemplo n.º 4
0
        public static string ColorsToString(FilamentConstants.ColorsEnum color)
        {
            var str = color.ToString();

            for (var startIndex = 1; startIndex < str.Length; ++startIndex)
            {
                if (char.IsUpper(str[startIndex]))
                {
                    str = str.Insert(startIndex, " ");
                    ++startIndex;
                }
            }
            return(str);
        }
Exemplo n.º 5
0
        public void AddCustomTemperature(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color, int temperature)
        {
            var key = new FilamentProfile.TypeColorKey(type, color);

            FilamentProfile.CustomOptions customOptions;
            customOptions.temperature = temperature;
            if (custom_filament_values.ContainsKey(key))
            {
                custom_filament_values[key] = customOptions;
            }
            else
            {
                custom_filament_values.TryAdd(key, customOptions);
            }
        }
Exemplo n.º 6
0
        public override void MyButtonCallback(ButtonWidget button)
        {
            switch (button.ID)
            {
            case 7:
                MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page11_CheatCodePage, CurrentDetails);
                break;

            case 8:
                FilamentConstants.ColorsEnum filamentColors = FilamentConstants.StringToFilamentColors(color_combobox.EditBox.Text);
                for (var index = 0; index < CurrentDetails.user_filaments.Count; ++index)
                {
                    if (CurrentDetails.user_filaments[index].Color != filamentColors)
                    {
                        if (CurrentDetails.user_filaments[index].Color == FilamentConstants.ColorsEnum.Other)
                        {
                            CurrentDetails.user_filaments[index] = new M3D.Spooling.Common.Filament(CurrentDetails.user_filaments[0].Type, filamentColors, CurrentDetails.user_filaments[0].CodeStr, CurrentDetails.user_filaments[0].Brand);
                        }
                        else if (CurrentDetails.user_filaments.Count == 1)
                        {
                            CurrentDetails.user_filaments.RemoveAt(index);
                            --index;
                        }
                    }
                }
                M3D.Spooling.Common.Filament filament;
                int temperature;
                if (!settingsManager.FilamentDictionary.ResolveToEncodedFilament(CurrentDetails.user_filaments[0].CodeStr, out filament, out temperature))
                {
                    temperature = settingsManager.GetFilamentTemperature(CurrentDetails.current_spool.filament_type, filamentColors);
                }

                CurrentDetails.current_spool.filament_color_code  = (uint)filamentColors;
                CurrentDetails.current_spool.filament_temperature = temperature;
                if (CurrentDetails.mode == Manage3DInkMainWindow.Mode.AddFilament)
                {
                    CurrentDetails.mode = Manage3DInkMainWindow.Mode.SetFilamentLocationInsertingNew;
                }
                else if (CurrentDetails.mode == Manage3DInkMainWindow.Mode.SetDetails)
                {
                    CurrentDetails.mode = Manage3DInkMainWindow.Mode.SetFilamentLocationAlreadyInserted;
                }

                MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page18_FilamentSpoolSize, CurrentDetails);
                break;
            }
        }
Exemplo n.º 7
0
        public void UpdateProfileList(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color)
        {
            filamentprofile_list.Items.Clear();
            var index = 0;
            var num   = 0;

            foreach (KeyValuePair <FilamentProfile.TypeColorKey, FilamentProfile.CustomOptions> customValue in settingsManager.FilamentDictionary.CustomValues)
            {
                if (customValue.Key.type == type && customValue.Key.color == color)
                {
                    index = num;
                }

                filamentprofile_list.Items.Add(new FilamentProfilePage.FilamentOptions(customValue.Key, customValue.Value));
                ++num;
            }
            SelectProfile(index);
        }
Exemplo n.º 8
0
        public void MyButtonCallback(ButtonWidget button)
        {
            switch (button.ID)
            {
            case 3:
                FilamentSpool.TypeEnum       type           = ((FilamentSpool.TypeEnum[])Enum.GetValues(typeof(FilamentSpool.TypeEnum)))[type_combobox.ListBox.Selected];
                FilamentConstants.ColorsEnum filamentColors = FilamentConstants.StringToFilamentColors(color_combobox.EditBox.Text);
                settings_manager.FilamentDictionary.AddCustomTemperature(type, filamentColors, FilamentConstants.Temperature.Default(type));
                Enabled = false;
                Visible = false;
                host.GlobalChildDialog -= (this);
                if (manageFilamentPage != null)
                {
                    manageFilamentPage.Enabled = true;
                }

                if (manageFilamentPage == null)
                {
                    break;
                }

                manageFilamentPage.UpdateProfileList(type, filamentColors);
                break;

            case 4:
                Enabled = false;
                Visible = false;
                if (manageFilamentPage != null)
                {
                    manageFilamentPage.Enabled = true;
                }

                host.GlobalChildDialog -= (this);
                break;
            }
        }
Exemplo n.º 9
0
 public Filament(Filament other)
 {
     type    = other.type;
     codeStr = other.codeStr;
     color   = other.color;
 }
Exemplo n.º 10
0
 public TypeColorKey(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color)
 {
     this.type  = type;
     this.color = color;
 }
Exemplo n.º 11
0
 public TypeColorKey(FilamentProfile.TypeColorKey other)
 {
     type  = other.type;
     color = other.color;
 }
Exemplo n.º 12
0
        public static FilamentConstants.Branding GetBrandingFrom(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color)
        {
            Filament filament = FilamentConstants.ProductList.Find(f =>
            {
                if (f.Color == color)
                {
                    return(f.Type == type);
                }

                return(false);
            });

            if (filament == null)
            {
                filament = FilamentConstants.ProductList.Find(f =>
                {
                    if (f.Color == FilamentConstants.ColorsEnum.Other)
                    {
                        return(f.Type == type);
                    }

                    return(false);
                });
                if (filament == null)
                {
                    return(FilamentConstants.Branding.Other);
                }
            }
            return(filament.Brand);
        }
Exemplo n.º 13
0
 private static Filament CFDT(FilamentSpool.TypeEnum type, FilamentConstants.ColorsEnum color, string code, FilamentConstants.Branding brand)
 {
     return(new Filament(type, color, code, brand));
 }
Exemplo n.º 14
0
        public static uint generateHEXFromColor(FilamentConstants.ColorsEnum color)
        {
            uint num = 538976511;

            switch (color)
            {
            case FilamentConstants.ColorsEnum.Blue:
                num = 10092543U;
                break;

            case FilamentConstants.ColorsEnum.Brown:
                num = 2336560127U;
                break;

            case FilamentConstants.ColorsEnum.Gold:
                num = 4292280575U;
                break;

            case FilamentConstants.ColorsEnum.Pink:
                num = 4279538687U;
                break;

            case FilamentConstants.ColorsEnum.Green:
                num = 8388863U;
                break;

            case FilamentConstants.ColorsEnum.LightBlue:
                num = 12582911U;
                break;

            case FilamentConstants.ColorsEnum.LightGreen:
                num = 2867986687U;
                break;

            case FilamentConstants.ColorsEnum.Magenta:
                num = 4278255615U;
                break;

            case FilamentConstants.ColorsEnum.Natural:
            case FilamentConstants.ColorsEnum.Clear:
                num = 4210752204U;
                break;

            case FilamentConstants.ColorsEnum.NeonBlue:
                num = ushort.MaxValue;
                break;

            case FilamentConstants.ColorsEnum.NeonOrange:
                num = 4288610559U;
                break;

            case FilamentConstants.ColorsEnum.NeonYellow:
                num = 4294902015U;
                break;

            case FilamentConstants.ColorsEnum.Orange:
                num = 4289003775U;
                break;

            case FilamentConstants.ColorsEnum.Purple:
            case FilamentConstants.ColorsEnum.MulberryPurple:
                num = 2420546047U;
                break;

            case FilamentConstants.ColorsEnum.Red:
                num = 3591252735U;
                break;

            case FilamentConstants.ColorsEnum.Silver:
                num = 2526451455U;
                break;

            case FilamentConstants.ColorsEnum.White:
            case FilamentConstants.ColorsEnum.PearlWhite:
                num = uint.MaxValue;
                break;

            case FilamentConstants.ColorsEnum.Yellow:
                num = 4294902015U;
                break;

            case FilamentConstants.ColorsEnum.HoneyClear:
                num = 4261410815U;
                break;

            case FilamentConstants.ColorsEnum.FuchsiaRed:
                num = 3425541119U;
                break;

            case FilamentConstants.ColorsEnum.CrimsonRed:
                num = 3591252735U;
                break;

            case FilamentConstants.ColorsEnum.FireOrange:
                num = 4284875007U;
                break;

            case FilamentConstants.ColorsEnum.MangoYellow:
                num = 4288217343U;
                break;

            case FilamentConstants.ColorsEnum.ShamrockGreen:
                num = 1724671743U;
                break;

            case FilamentConstants.ColorsEnum.CobaltBlue:
                num = 6737151U;
                break;

            case FilamentConstants.ColorsEnum.CaribbeanBlue:
                num = 8833279U;
                break;

            case FilamentConstants.ColorsEnum.TitaniumSilver:
                num = 2442236415U;
                break;

            case FilamentConstants.ColorsEnum.CharcoalBlack:
                num = 791621631U;
                break;

            case FilamentConstants.ColorsEnum.WhitePearl:
                num = 4109625855U;
                break;

            case FilamentConstants.ColorsEnum.CrystalClear:
                num = 4092851199U;
                break;

            case FilamentConstants.ColorsEnum.LightFuchsia:
                num = 4279613439U;
                break;

            case FilamentConstants.ColorsEnum.DeepCrimson:
                num = 3456106751U;
                break;

            case FilamentConstants.ColorsEnum.DeepShamrock:
                num = 326911743U;
                break;

            case FilamentConstants.ColorsEnum.DeepColbalt:
                num = 2415359U;
                break;

            case FilamentConstants.ColorsEnum.LightCarribean:
                num = 8833279U;
                break;

            case FilamentConstants.ColorsEnum.DeepMulberry:
                num = 2550188799U;
                break;

            case FilamentConstants.ColorsEnum.SatelliteSilver:
            case FilamentConstants.ColorsEnum.CoolGray:
                num = 2358422783U;
                break;

            case FilamentConstants.ColorsEnum.DeepLemon:
                num = 4226289663U;
                break;

            case FilamentConstants.ColorsEnum.SunsetOrange:
                num = 4288813055U;
                break;

            case FilamentConstants.ColorsEnum.OnyxBlack:
            case FilamentConstants.ColorsEnum.BlackCarbonFiber:
                num = 791621631U;
                break;

            case FilamentConstants.ColorsEnum.DragonRedTouch:
            case FilamentConstants.ColorsEnum.DragonRedHot:
                num = 3858759935U;
                break;

            case FilamentConstants.ColorsEnum.RoseRedTouch:
                num = 4279858687U;
                break;

            case FilamentConstants.ColorsEnum.CoralOrangeTouch:
            case FilamentConstants.ColorsEnum.CoralOrangeWarm:
                num = 4282849791U;
                break;

            case FilamentConstants.ColorsEnum.DespicableYellowTouch:
                num = 4294902015U;
                break;

            case FilamentConstants.ColorsEnum.MonsterGreenTouch:
                num = 1558600959U;
                break;

            case FilamentConstants.ColorsEnum.GenieBlueTouch:
            case FilamentConstants.ColorsEnum.GenieBlueIce:
                num = 869072895U;
                break;

            case FilamentConstants.ColorsEnum.GargoyleBlackTouch:
                num = 741092607U;
                break;

            case FilamentConstants.ColorsEnum.TrichromeNebula:
                num = 2420546047U;
                break;

            case FilamentConstants.ColorsEnum.TrichromeTiger:
                num = 2337751807U;
                break;

            case FilamentConstants.ColorsEnum.Grey:
                num = 2526451455U;
                break;

            case FilamentConstants.ColorsEnum.MilkWhite:
                num = 4210752255U;
                break;

            case FilamentConstants.ColorsEnum.DurableClear:
                num = uint.MaxValue;
                break;

            case FilamentConstants.ColorsEnum.SuperBlue:
                num = 8833279U;
                break;

            case FilamentConstants.ColorsEnum.MightyBlue:
                num = 869072895U;
                break;

            case FilamentConstants.ColorsEnum.YogaGreen:
                num = 92407807U;
                break;

            case FilamentConstants.ColorsEnum.RockyGreen:
                num = 326911743U;
                break;

            case FilamentConstants.ColorsEnum.OrangeHeft:
                num = 4286775551U;
                break;

            case FilamentConstants.ColorsEnum.FlexibleRuby:
                num = 3591252735U;
                break;

            case FilamentConstants.ColorsEnum.StrongPurple:
                num = 2420546047U;
                break;

            case FilamentConstants.ColorsEnum.RavenPurple:
                num = 2550188799U;
                break;

            case FilamentConstants.ColorsEnum.UtilityGrey:
                num = 2442236415U;
                break;

            case FilamentConstants.ColorsEnum.ImpactBlack:
                num = byte.MaxValue;
                break;

            case FilamentConstants.ColorsEnum.ParakeetTouch:
                num = 1558600959U;
                break;

            case FilamentConstants.ColorsEnum.PeacockTouch:
                num = 2550188799U;
                break;

            case FilamentConstants.ColorsEnum.EclectusTouch:
                num = 2420546047U;
                break;

            case FilamentConstants.ColorsEnum.CandyGreen:
                num = 3170877951U;
                break;

            case FilamentConstants.ColorsEnum.DeepCobalt:
                num = 3368703U;
                break;

            case FilamentConstants.ColorsEnum.BrickRed:
                num = 2216634367U;
                break;

            case FilamentConstants.ColorsEnum.FireTruck:
                num = 3458214399U;
                break;

            case FilamentConstants.ColorsEnum.PumpkinOrange:
                num = 4285864191U;
                break;

            case FilamentConstants.ColorsEnum.BerryPurple:
                num = 1543845119U;
                break;

            case FilamentConstants.ColorsEnum.BlueMoon:
                num = 3233870079U;
                break;

            case FilamentConstants.ColorsEnum.AntiqueGold:
                num = 3467395583U;
                break;

            case FilamentConstants.ColorsEnum.SnakeCopper:
                num = 3094557695U;
                break;

            case FilamentConstants.ColorsEnum.AppleGreen:
                num = 1539454719U;
                break;

            case FilamentConstants.ColorsEnum.SkyBlue:
                num = 2278484991U;
                break;

            case FilamentConstants.ColorsEnum.OrientRed:
                num = 2651918079U;
                break;
            }
            return(num);
        }