Exemplo n.º 1
0
        /// <summary>
        /// Отображение панели с изменением данных локации.
        /// </summary>
        private void OpenLocationInfoPanel()
        {
            LocationInfoPanel.Visible = true;


            LocationDataLabel.ForeColor = MyColors._00A0E3();
        }
Exemplo n.º 2
0
        private void myColorsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string   currentColor = myColorsComboBox.SelectedItem.ToString();
            MyColors myColor      = (MyColors)Enum.Parse(typeof(MyColors), currentColor);

            selectedValuesLabel.Text = myColor.ToString();
        }
Exemplo n.º 3
0
    public Tree(bool shrub = false)
    {
        //basic tree
        seedCol   = MyColors.randomBrown();
        bobbleCol = MyColors.randomGreen();

        generalVar = 0.2f;
        sizeN      = 4;
        sizeD      = 5;

        if (shrub)
        {
            layerCount = new ArrayList();
            {
                int numLayers = UnityEngine.Random.Range(1, shrubMaxLayers + 1);
                for (int j = 0; j < numLayers; j++)
                {
                    layerCount.Add(UnityEngine.Random.Range(1, shrubMaxBranches + 1));
                }
            }
        }
        else
        {
            layerCount = new ArrayList();
            {
                int numLayers = UnityEngine.Random.Range(1, maxLayers + 1);
                for (int j = 0; j < numLayers; j++)
                {
                    layerCount.Add(UnityEngine.Random.Range(1, maxBranches + 1));
                }
            }
        }
    }
Exemplo n.º 4
0
        /// <summary>
        /// Отображение панели с изменением данных локации.
        /// </summary>
        private void OpenLocationInfoPanel()
        {
            LocationInfoPanel.Visible   = true;
            CardPropertiesPanel.Visible = false;

            LocationDataLabel.ForeColor = MyColors._00A0E3();

            CardPropertiesLabel.ForeColor = Color.Black;
        }
        /// <summary>
        /// Отображение панели с изменением свойств карт локации.
        /// </summary>
        private void OpenCardPropertiesPanel()
        {
            SubDivisionInfoPanel.Visible   = false;
            CardPropertiesPanel.Visible    = true;
            AllCardPropertiesPanel.Visible = true;

            SubDivisionDataLabel.ForeColor = Color.Black;

            CardPropertiesLabel.ForeColor = MyColors._00A0E3();
        }
Exemplo n.º 6
0
 public void InitField(DataObject o)
 {
     if (o.Image != null)
     {
         image.sprite = o.Image;
     }
     ObjectId = o.ObjectId;
     gameObject.GetComponent <Image>().color = MyColors.GetBackgroundColorByObjectType(Inventory.instance.GetItemByItemId(ObjectId).ObjectType);
     UpdateItemDisplay();
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            MyColors r = MyColors.Red;
            MyColors g = MyColors.Green;
            MyColors b = MyColors.Blue;

            Console.WriteLine((int)r);
            Console.WriteLine((int)g);
            Console.WriteLine((int)b);
            Console.ReadLine();
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
            Console.InputEncoding  = Encoding.Unicode;
            Console.OutputEncoding = Encoding.Unicode;

            Console.Title = "Home work 05_colors";

            MyColors allColors = MyColors.None | MyColors.Black | MyColors.Blue |
                                 MyColors.Cyan | MyColors.Green | MyColors.Grey | MyColors.Magenta |
                                 MyColors.Red | MyColors.White | MyColors.Yellow;

            Console.WriteLine($"\nВыберите четыре любимых цвета из списка: {allColors}");
            try
            {
                MyColors   favoriteColors     = MyColors.None;
                string[]   colorRequestNumber = { "первый", "второй", "третий", "четвертый" };
                MyColors[] color = new MyColors[4];                 // array of selected colors
                for (int i = 0; i < 4; i++)
                {
                    Console.Write($"\nВведите {colorRequestNumber[i]} любимый цвет: ");
                    object color1;                     // temporary variable for user input validation
                    while (true)
                    {
                        if (Enum.TryParse(typeof(MyColors), Console.ReadLine(), true, out color1))
                        {
                            color[i] = (MyColors)color1;
                            break;
                        }
                        else
                        {
                            Console.WriteLine("Ошибка!");
                        }
                    }
                    Console.WriteLine($"Цвет {colorRequestNumber[i]} выбран: {color[i]}");
                    favoriteColors = favoriteColors | color[i];
                }

                MyColors notFavoriteColors;
                notFavoriteColors = allColors ^ favoriteColors;
                Console.WriteLine($"\nЦвета в палитре Избранное : {favoriteColors}");
                Console.WriteLine($"\nЦвета не вошедшие в палитру Избранное: {notFavoriteColors}");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Write("Введены некорректные данные: ");
                Console.WriteLine(e.Message);
                throw;
            }
        }
Exemplo n.º 9
0
    };                                            //2d array, where each item is a layer

    public void addNextLayer()
    {
        //Debug.Log("adding next Layer");

        if (bobbles.Count >= layerCount.Count)
        {
            return;
        }
        ArrayList prevLayer;

        if (bobbles.Count == 0)
        {
            //Debug.Log("bobbles.Count == 0");
            prevLayer = new ArrayList {
                firstBobble
            };
        }
        else
        {
            //Debug.Log("bobbles.Count != 0");
            prevLayer = (ArrayList)bobbles[bobbles.Count - 1];
        }

        ArrayList newLayer = new ArrayList {
        };

        foreach (GameObject bobble in prevLayer)
        {
            for (int i = 0; i < (int)layerCount[bobbles.Count]; i++)
            {
                GameObject newBobble = GameObject.Instantiate(firstBobble);
                newBobble.transform.position              = bobble.transform.position;
                newBobble.GetComponent <Grow>().maxSize   = bobble.GetComponent <Grow>().maxSize *(sizeN / sizeD);
                newBobble.GetComponent <Rigidbody>().mass = bobble.GetComponent <Rigidbody>().mass *(sizeN / sizeD) * (sizeN / sizeD) * (sizeN / sizeD);
                newBobble.GetComponent <Grow>().makeSmall();                                                            //set maxsize here
                newBobble.GetComponent <SpringJoint>().connectedBody = bobble.GetComponent <Rigidbody>();
                newBobble.GetComponent <SpringJoint>().spring        = 100 * newBobble.GetComponent <Rigidbody>().mass; //make spring strength proportional to mass
                newBobble.GetComponent <Grow>().motherTree           = this;

                //make a random brown color
                Material newMat = new Material(mat);
                newMat.color = MyColors.Varient(bobble.GetComponent <Renderer>().material.color, generalVar);
                newBobble.GetComponent <Renderer>().material = newMat;

                firstBobble.GetComponent <SpringJoint>().spring += 100 * newBobble.GetComponent <Rigidbody>().mass;
                newLayer.Add(newBobble);
            }
        }
        bobbles.Add(newLayer);
        //Debug.Log("finnished adding next Layer");
    }
Exemplo n.º 10
0
        private void LocationsLabel_Click(object sender, EventArgs e)
        {
            LocationsLabel.Font         = new Font(LocationsLabel.Font, FontStyle.Underline);
            LocationsLabel.ForeColor    = MyColors._00A0E3();
            SubDivisionsLabel.Font      = new Font(SubDivisionsLabel.Font, FontStyle.Regular);
            SubDivisionsLabel.ForeColor = Color.Black;

            AddLocationButton.Visible    = true;
            AddSubDivisionButton.Visible = false;

            LocationsPanel.Visible    = true;
            SubDivisionsPanel.Visible = false;

            LocationsDataGridView.DataSource = AllLocations;
        }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     MyPoints.Clear();
     for (int i = 0; i < SpawnedPoints; i++)
     {
         Vector3 NewPosition = new Vector3(Random.Range(-Range, Range), Random.Range(-Range, Range), Random.Range(-Range, Range));
         //NewPosition.x = Mathf.Clamp(NewPosition.x, -Range, Range);
         MyPoints.Add(NewPosition);
         MyColors.Add(new Color32((byte)Random.Range(0.0f, 1.0f),
                                  (byte)Random.Range(0.0f, 1.0f),
                                  (byte)Random.Range(0.0f, 1.0f),
                                  (byte)1.0f));
     }
     CreateMesh();
 }
Exemplo n.º 12
0
        public Page()
        {
            InitializeComponent();
            //<SnippetDataContext>
            // Create an instance of the MyColors class
            // that implements INotifyPropertyChanged.
            MyColors textcolor = new MyColors();

            // Brush1 is set to be a SolidColorBrush with the value Red.
            textcolor.Brush1 = new SolidColorBrush(Colors.Red);

            // Set the DataContext of the TextBox MyTextBox.
            MyTextBox.DataContext = textcolor;
            //</SnippetDataContext>
        }
        private void btnBrowseColor_Click(object sender, EventArgs e)
        {
            using (DialogColor colorPicker = new DialogColor())
            {
                if (!string.IsNullOrEmpty(txtColor.Text))
                {
                    colorPicker.SetCurrentColor(MyColors.ParseColor(txtColor.Text));
                }

                if (colorPicker.ShowDialog() == DialogResult.OK)
                {
                    Color color = colorPicker.Color;
                    txtColor.Text = string.Format("{0},{1},{2},{3}", color.A, color.R, color.G, color.B);
                }
            }
        }
Exemplo n.º 14
0
        private void show(MyColors c)
        {
            Color col;

            switch (c)
            {
            case MyColors.RED:
                col = Colors.Red;
                break;

            case MyColors.GREEN:
                col = GREEN;
                break;

            case MyColors.BLUE:
                col = BLUE;
                break;

            default:
                col = Colors.White;
                break;
            }

            lock (this) shown = true;
            Dispatcher.Invoke(() =>
            {
                border.BorderBrush = new SolidColorBrush(col);
                WindowState        = WindowState.Maximized;
                Show();

                Action <Task> loop = null;
                loop = (t) =>
                {
                    bool cont = false;
                    lock (this) cont = shown;
                    if (!cont)
                    {
                        return;
                    }
                    Dispatcher.Invoke(() => { Topmost = false; Topmost = true; });
                    Task.Delay(100).ContinueWith(loop);
                };
                loop(null);
            });
        }
Exemplo n.º 15
0
        public void GizmoTick()
        {
            ObstacleOcclusionCalculationManagerV2 ObstacleOcclusionCalculationManagerV2 = ObstacleOcclusionCalculationManagerV2.Get();

            foreach (var obstacleListener in this.obstacleListeners)
            {
                ObstacleOcclusionCalculationManagerV2.TryGetCalculatedOcclusionFrustumsForObstacleListener(obstacleListener, out Dictionary <int, List <FrustumPointsPositions> > allCalculatedFrustumPositions);
                if (allCalculatedFrustumPositions != null)
                {
                    foreach (var calculatedFrustumPositions in allCalculatedFrustumPositions.Values)
                    {
                        foreach (var calculatedFrustumPosition in calculatedFrustumPositions)
                        {
                            calculatedFrustumPosition.DrawInScene(MyColors.GetColorOnIndex(obstacleListener.ObstacleListenerUniqueID));
                        }
                    }
                }
            }
        }
        public GradientStop(string color, string offset)
        {
            this.Color = MyColors.ParseColor(color);

            if (this.Color == null)
            {
                throw new Exception("Color is unknown.");
            }

            float offset2;

            if (float.TryParse(offset, NumberStyles.Any, CultureInfo.InvariantCulture, out offset2))
            {
                this.Offset = offset2;
            }
            else
            {
                this.Offset = 0;
            }
        }
Exemplo n.º 17
0
    public override string ToString()
    {
        String s = "pot number: " + potNum + "\nlayer counts: ";

        foreach (int layer in layerCount)
        {
            s = s + layer + ", ";
        }
        s  = s + "\nsize: " + sizeN + "/" + sizeD + "\n";
        s  = s + "volitility: " + generalVar + "\n";
        s += "Color: " + bobbleCol + " : " + MyColors.getColor(bobbleCol) + "\n";
        Species spec = Almanac.getSpecies(this);

        if (spec != null)
        {
            s = s + spec.name;
        }



        return(s);
    }
Exemplo n.º 18
0
        void _monitoring()
        {
            // --> Controllo se calcolare la percentuale sul bilancio
            if (MyCalcMode == CalcMode.Percentage)
            {
                BEfrom = Math.Round((FixedBalance / 100) * FixedBEfrom, 2);
                BE     = Math.Round((FixedBalance / 100) * FixedBE, 2);
            }

            // --> Raccolgo tutte le operazioni su questo simbolo
            int nPositions = 0;

            double ttnp = 0.0;

            foreach (var Position in Positions)
            {
                if (!GlobalTarget && Position.SymbolName != SymbolName)
                {
                    continue;
                }

                ttnp += Position.NetProfit;
                nPositions++;
            }

            // --> Se non ci sono trade da monitorare deattivo e basta
            if (nPositions < 1)
            {
                // --> Disattivo
                Activated = false;

                // --> Resetto il nuovo bilancio
                FixedBalance = Account.Balance;
            }

            // --> Se selezionato e se non ci sono trade, fermo il cBot
            if (AutoStop && nPositions < 1)
            {
                Stop();
            }

            // --> Valorizzo l'attivazione se raggiunto
            if (!Activated && ((BEfrom > BE && ttnp >= BEfrom) || (BEfrom < BE && ttnp <= BEfrom)))
            {
                Activated = true;
            }

            // --> Stampo a video alcune informazioni
            string scope     = (GlobalTarget) ? "all cross" : "the current cross";
            string logica    = (BEfrom == BE) ? "target" : (BEfrom > BE) ? "positive" : "negative";
            string direction = (BEfrom > BE) ? "less" : "greater";
            string netpt     = String.Format("{0:0.00}", ttnp);

            string phrase = (Activated) ? string.Format("Activated, I will close all trades for\r\n{0} if net profit is {1} or equal {2}", scope, direction, BE) : string.Format("Relax, I'm monitoring {0} for\r\n{1} logic and waiting net profit reaches {2}", scope, logica, BEfrom);

            string[] items =
            {
                "MONEY BREAK EVEN\r\n",
                phrase,
                "\r\nNET PROFIT\r\n{0}"
            };
            string info = string.Join("\r\n", items);

            info = string.Format(info, netpt);

            MyColors mycolor = (BEfrom == BE) ? Boxcolortarget : (BEfrom > BE) ? Boxcolorpositive : Boxcolornegative;

            if (Activated)
            {
                mycolor = Boxcoloractive;
            }

            Chart.DrawStaticText("BoxMBE", info, VAlign, HAlign, Color.FromName(mycolor.ToString("G")));

            // --> Se attivato e se sono la soglia di BE chiudo tutto
            if ((Activated && ((BEfrom > BE && ttnp <= BE) || (BEfrom < BE && ttnp >= BE))) || (BEfrom == BE && ((BE >= 0 && ttnp >= BE) || (BE < 0 && ttnp <= BE))))
            {
                // --> Chiudo tutti i trade

                foreach (var Position in Positions)
                {
                    if (!GlobalTarget && Position.SymbolName != SymbolName)
                    {
                        continue;
                    }

                    ClosePositionAsync(Position);
                }

                // --> Chiudo tutti gli ordini pendenti se richiesto
                if (RemovePO)
                {
                    foreach (var order in PendingOrders)
                    {
                        if (!GlobalTarget && order.SymbolName != SymbolName)
                        {
                            continue;
                        }

                        CancelPendingOrderAsync(order);
                    }
                }

                // --> Resetto il flag
                Activated = false;
            }
        }
Exemplo n.º 19
0
 private void Control_Click(object sender, EventArgs e)
 {
     ((Control)sender).BackColor = MyColors.GetColor(((Control)sender).BackColor);
 }
Exemplo n.º 20
0
        public static void Main(string[] args)
        {
            var enumType        = typeof(TestEnum);
            var enumType2       = typeof(TestEnum2);
            var enumValues      = Enum.GetValues(typeof(TestEnum2));
            var eleType         = enumValues.GetValue(0) is long;
            var underLyingType1 = Enum.GetUnderlyingType(typeof(TestEnum));
            var underLineType   = Enum.GetUnderlyingType(typeof(TestEnum2));

            var localHost = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList.GetValue(0).ToString();
            var ipv4      = GetIP4Address();

            //            var testResult = GetObjFormEnumS<TestEnum>(new List<Expression<Func<TestEnum, TestEnum>>>{ x => TestEnum.ABCDE });
            //            var testResult2 = GetObjFormEnumS<TestEnum>();
            string[] companies = { "Consolidated Messenger", "Alpine Ski House",     "Southridge Video",         "City Power & Light",
                                   "Coho Winery",            "Wide World Importers", "Graphic Design Institute", "Adventure Works",
                                   "Humongous Insurance",    "Woodgrove Bank",       "Margie's Travel",          "Northwind Traders",
                                   "Blue Yonder Airlines",   "Trey Research",        "The Phone Company",
                                   "Wingtip Toys",           "Lucerne Publishing",   "Fourth Coffee" };

            IQueryable <string> queryableData = companies.AsQueryable();

            ParameterExpression pe = Expression.Parameter(typeof(string), "company");

            // where(company => (company.ToLower() == "coho winery" || company.Length > 16))
            // create an expression tree represents the expression 'company.ToLower() == "coho winery"'.
            Expression left = Expression.Call(pe, typeof(string).GetMethod("ToLower", System.Type.EmptyTypes));

            Console.WriteLine("Hello World!");


            ConstantExpression constExp = Expression.Constant("abc", typeof(string));

            MethodCallExpression _methodExp =
                Expression.Call(typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) }),
                                new Expression[] { constExp });

            Expression <Action> lambdaExp = Expression.Lambda <Action>(_methodExp);

            var arg1 = Expression.Parameter(typeof(int), "a");
            var arg2 = Expression.Parameter(typeof(int), "b");
            LambdaExpression normalExp =
                Expression.Lambda(Expression.Add(arg1, arg2), arg1
                                  , arg2);

            Delegate compDel = normalExp.Compile();

            var comp = normalExp.Compile().DynamicInvoke(1, 2);


            Expression <Func <int, int, int> > normalExp2 = Expression.Lambda <Func <int, int, int> >(Expression.Add(arg1, arg2), arg1, arg2);

            var compDel2 = normalExp2.Compile();
            var result2  = compDel2(1, 2);
            var comp2    = normalExp2.Compile().DynamicInvoke(5, 2);

            Expression <Func <int, int, int> > normalExp3 = (x, y) => x + y;

            Func <int, int, int> compDel3 = normalExp3.Compile();
            var result3 = compDel3(1, 2);

            var comp3 = compDel3.DynamicInvoke(4, 4);


            LambdaExpression normalExp4 = Expression.Lambda(
                Expression.Block(Expression.Call(typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) }),
                                                 Expression.Constant("11111"))));

            Delegate compDel4 = normalExp4.Compile();
            var      comp4    = compDel4.DynamicInvoke();


            Expression <Action> normal5 = () => Console.WriteLine("aaaa");

            Func <int, int> isPositive = x =>
            {
                return(x + 10);
            };



            Action action5 = normal5.Compile();

            action5();

            var testCode = ReadClassTemplate();

            File.WriteAllText(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + @"\test.cs", testCode);

            MyColors enumColor    = MyColors.Blue | MyColors.Yellow | MyColors.Green | MyColors.ligth;
            var      intEnumColor = (int)enumColor;
            var      retrieveEnum = (MyColors)intEnumColor;

            Console.WriteLine(retrieveEnum);
            Console.WriteLine(enumColor);
            if ((enumColor & MyColors.Yellow) == MyColors.Yellow)
            {
                Console.WriteLine($"have element {MyColors.Yellow}");
                // Yellow has been set...
            }
            enumColor &= ~MyColors.Yellow;
            if (enumColor.HasFlag(MyColors.Yellow))
            {
                Console.WriteLine($"have element {MyColors.Yellow}");
            }
            enumColor &= ~MyColors.ligth;
            if (enumColor.HasFlag(MyColors.ligth))
            {
                Console.WriteLine($"have element {MyColors.ligth}");
            }
        }
Exemplo n.º 21
0
    public Tree(Tree p1, Tree p2)
    {
        //mix of parents genetics, plus mutations

        /*
         * public ArrayList layerCount; //length = num extra layers, each item gives the num braches per layer
         * public float sizeN;
         * public float sizeD;
         *
         * public Color seedCol;
         * public Color bobbleCol;
         * public int bobbleColVar;
         */


        //general variance
        generalVar = myRange(p1.generalVar, p2.generalVar);
        if (commonMute())
        {
            generalVar += UnityEngine.Random.Range(-generalVar / 10, generalVar / 10);
        }
        if (rareMute())
        {
            generalVar += UnityEngine.Random.Range(-generalVar / 2, generalVar / 2);
        }
        //sanitation
        if (generalVar >= 1 || generalVar <= 0)
        {
            generalVar = 0.5f;
        }


        //sizeN
        sizeN = myRange(p1.sizeN, p2.sizeN);
        if (commonMute())
        {
            sizeN += UnityEngine.Random.Range(-sizeN / 10, sizeN / 10);
        }
        if (rareMute())
        {
            sizeN += UnityEngine.Random.Range(-sizeN / 2, sizeN / 2);
        }
        //sizeD
        sizeD = myRange(p1.sizeD, p2.sizeD);
        if (commonMute())
        {
            sizeD += UnityEngine.Random.Range(-sizeD / 10, sizeD / 10);
        }
        if (rareMute())
        {
            sizeD += UnityEngine.Random.Range(-sizeD / 2, sizeD / 2);
        }
        ///sanitation
        if (sizeN < 1)
        {
            sizeN = 1;
        }
        if (sizeD < sizeN + 1)
        {
            sizeD = sizeN + 1;
        }

        //colors
        seedCol   = MyColors.Varient(p1.seedCol, p2.seedCol, generalVar);
        bobbleCol = MyColors.Varient(p1.bobbleCol, p2.bobbleCol, generalVar);

        bobbles    = new ArrayList {
        };
        layerCount = new ArrayList {
        };
        int i;

        for (i = 0; i < Mathf.Min(p1.layerCount.Count, p2.layerCount.Count); i++)
        {
            if (UnityEngine.Random.Range(0.0f, 1.0f) < 0.5)
            {
                layerCount.Add(p1.layerCount[i]);
            }
            else
            {
                layerCount.Add(p2.layerCount[i]);
            }
        }
        i++;
        while (heads())
        {
            if (p1.layerCount.Count > i)
            {
                layerCount.Add(p1.layerCount[i]);
            }
            else if (p2.layerCount.Count > i)
            {
                layerCount.Add(p2.layerCount[i]);
            }
            else
            {
                break;
            }
            i++;
        }


        mutateStructure();
    }
Exemplo n.º 22
0
        public View CreateViewCaptionValue(string caption = "", string centerText = null, object value = null, Action onClicked = null)
        {
            var bigCaption = caption.StartsWith("#");

            var view = new FlexLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,

                AlignContent = FlexAlignContent.Stretch,
            };

            bool isDeviceNarrow = App.IsSmallDevice();

            if (isDeviceNarrow)
            {
                view.Direction  = FlexDirection.Column;
                view.AlignItems = FlexAlignItems.Stretch;
            }
            else
            {
                view.JustifyContent = FlexJustify.SpaceBetween;
                view.AlignItems     = FlexAlignItems.Center;
                view.Wrap           = FlexWrap.Wrap;
                view.Direction      = FlexDirection.Row;
            }

            // Caption
            {
                bool centerTextHorizontally = false;
                if (caption.StartsWith("^"))
                {
                    centerTextHorizontally = true;
                    caption = caption.TrimStart('^');
                }
                var lableCaption = new Label()
                {
                    Text                    = caption.TrimStart('#'),
                    TextColor               = Color.Black,
                    HorizontalOptions       = LayoutOptions.StartAndExpand,
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = centerTextHorizontally ? TextAlignment.Center : TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontAttributes          = bigCaption ? FontAttributes.Bold : FontAttributes.None,
                    HeightRequest           = 50,
                    LineBreakMode           = LineBreakMode.NoWrap,
                };
                if (bigCaption)
                {
                    lableCaption.FontSize *= 1.20;
                }
                FlexLayout.SetGrow(lableCaption, 1);
                view.Children.Add(lableCaption);
            }

            // Center text
            if (centerText != null)
            {
                var lableCaption = new Label()
                {
                    Text              = centerText,
                    TextColor         = Color.Black,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    VerticalOptions   = LayoutOptions.StartAndExpand,
                    FontSize          = 12
                };
                FlexLayout.SetGrow(lableCaption, 3);
                view.Children.Add(lableCaption);
            }

            // Value
            {
                var buttonValue = new XButton()
                {
                    HorizontalOptions = LayoutOptions.EndAndExpand,
                    //HeightRequest = 50,
                };
                FlexLayout.SetGrow(buttonValue, 2);
                if (bigCaption)
                {
                    buttonValue.FontSize *= 1.30;
                }

                if (value is decimal or double or float)
                {
                    buttonValue.Text      = ((decimal)value).ToString("C");
                    buttonValue.TextColor = MyColors.GetCurrencyColor((decimal)value);
                    buttonValue.SetAsCurrenty();
                }
Exemplo n.º 23
0
 public ColorItem(MyColors color)
 {
     this.color = color.ToString();
 }
Exemplo n.º 24
0
        public Simulation(string counter, string fileName, string sizeX, string sizeY, string sizeZ,
                          string neighbourhood, string bc, string numberOfNucleons, string simulation,
                          string numberOfIterations, string kt, string j,
                          StackPanel simulationPanel, ListView listView)
        {
            this.myColors = new MyColors();

            this.number = counter;

            int maxSize = Math.Max(Int32.Parse(sizeX), Math.Max(Int32.Parse(sizeY), Int32.Parse(sizeZ)));

            if (maxSize < 25)
            {
                this.size    = 20;
                this.gapSize = 1;
            }
            else if (maxSize < 50)
            {
                this.size    = 10;
                this.gapSize = 2;
            }
            else if (maxSize < 100)
            {
                this.size    = 5;
                this.gapSize = 4;
            }
            else if (maxSize < 250)
            {
                this.size    = 2;
                this.gapSize = 6;
            }
            else
            {
                this.size    = 1;
                this.gapSize = 10;
            }

            myColors.InitializeCellColors(Int32.Parse(numberOfNucleons) + 1);

            long milliseconds = DateTimeOffset.Now.ToUnixTimeMilliseconds();

            string FilePath = @"C:\Users\Marcin\source\repos\GrainGrowthUI\GrainGrowthUI\";

            this.myFilePath = FilePath + fileName + "_" + milliseconds + ".xml";

            this.item = new SimulationListItem
            {
                ID                 = counter,
                SizeX              = sizeX,
                SizeY              = sizeY,
                SizeZ              = sizeZ,
                Neighbourhood      = neighbourhood,
                BC                 = bc,
                Nucleons           = numberOfNucleons,
                Simulation         = simulation,
                NumberOfIterations = numberOfIterations,
                KT                 = kt,
                J             = j,
                ProgressValue = 0,
                ProgressBool  = true
            };

            listView.Items.Add(item);


            using (XmlWriter writer = XmlWriter.Create(this.myFilePath))
            {
                writer.WriteStartElement("CG_config");
                writer.WriteElementString("FilePath", fileName + ".txt");
                writer.WriteElementString("SizeX", sizeX);
                writer.WriteElementString("SizeY", sizeY);
                writer.WriteElementString("SizeZ", sizeZ);
                writer.WriteElementString("Neighbourhood", neighbourhood);
                writer.WriteElementString("BC", bc);
                writer.WriteElementString("Nucleons", numberOfNucleons);
                writer.WriteElementString("Simulation", simulation);
                writer.WriteElementString("NumberOfIterations", numberOfIterations);
                writer.WriteElementString("KT", kt);
                writer.WriteElementString("J", j);
                writer.WriteEndElement();
                writer.Flush();
            }
        }