Exemple #1
0
        private async Task <TColValue> GetKeyCol <TColValue, TPrimaryKey>(Nuid id, string table_name, TPrimaryKey primary_key, int col)
        {
            if (NodeType == NodeType.Grain)
            {
                Entity entity = EntityManager.Get(id);

                if (entity != null)
                {
                    Table <TPrimaryKey> table = entity.GetTable(table_name) as Table <TPrimaryKey>;
                    if (table == null)
                    {
                        return(default(TColValue));
                    }

                    return(table.GetCol <TColValue>(primary_key, col));
                }
            }
            else if (NodeType == NodeType.Cache)
            {
                NList row_value = await GetCacheTableKeyValue(id, table_name, primary_key);

                return(row_value.Get <TColValue>(col));
            }

            return(default(TColValue));
        }
 /// <summary>
 /// 实例化 <see cref="CreateSecurityGroupRequest" /> 类.
 /// </summary>
 /// <param name="region">数据中心</param>
 /// <param name="groupname">防火墙组名称</param>
 /// <param name="description">防火墙组描述.</param>
 /// <param name="rule">防火墙规则</param>
 public CreateSecurityGroupRequest(string region, string groupname, string description, NList rule)
 {
     Region      = region;
     GroupName   = groupname;
     Description = description;
     Rule        = rule;
 }
Exemple #3
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            // add come property editors
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_NamedColorPicker).CreatePropertyEditors(
                m_NamedColorPicker,
                NNamedColorPicker.EnabledProperty,
                NNamedColorPicker.HorizontalPlacementProperty,
                NNamedColorPicker.VerticalPlacementProperty
                );

            for (int i = 0; i < editors.Count; i++)
            {
                stack.Add(editors[i]);
            }

            // create the events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
        /// <summary>
        ///
        /// </summary>
        private void FillRandomData()
        {
            NList <NBarSeries> barSeriesList = new NList <NBarSeries>();

            // collect all bar series in the view
            for (int chartIndex = 0; chartIndex < m_ChartView.Surface.Charts.Length; chartIndex++)
            {
                NCartesianChart chart = (NCartesianChart)m_ChartView.Surface.Charts[chartIndex];

                for (int seriesIndex = 0; seriesIndex < chart.Series.Count; seriesIndex++)
                {
                    NBarSeries barSeries = chart.Series[seriesIndex] as NBarSeries;

                    if (barSeries != null)
                    {
                        barSeriesList.Add(barSeries);
                        barSeries.DataPoints.Clear();
                    }
                }
            }

            // fill all bar series with random data
            Random random = new Random();

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < barSeriesList.Count; j++)
                {
                    NBarSeries barSeries = barSeriesList[j];
                    barSeries.DataPoints.Add(new NBarDataPoint(random.Next(10, 100)));
                }
            }
        }
Exemple #5
0
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_ColorPicker).CreatePropertyEditors(
                m_ColorPicker,
                NHsbWheelColorPicker.UpdateWhileDraggingProperty,
                NHsbWheelColorPicker.SelectedColorProperty,
                NHsbWheelColorPicker.HueSelectorSectorAngleProperty,
                NHsbWheelColorPicker.HueSelectorExtendPercentProperty,
                NHsbWheelColorPicker.HueWheelWidthPercentProperty,
                NHsbWheelColorPicker.SBSelectorRadiusPercentProperty,
                NHsbWheelColorPicker.SBTriangleMarginsPercentProperty
                );

            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            for (int i = 0; i < editors.Count; i++)
            {
                stack.Add(editors[i]);
            }

            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Exemple #6
0
        public async Task <Nuid> Create(string type, Nuid origin, NList args)
        {
            long unique = IdGenerator.NewIdentity();
            Nuid id     = Nuid.New(unique, origin.Origin);

            return(await Create(id, type, args));
        }
Exemple #7
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            NStackPanel             propertiesStack = new NStackPanel();
            NList <NPropertyEditor> editors         = NDesigner.GetDesigner(m_ComboBox).CreatePropertyEditors(
                m_ComboBox,
                NComboBox.EnabledProperty,
                NComboBox.HorizontalPlacementProperty,
                NComboBox.VerticalPlacementProperty,
                NComboBox.DropDownButtonPositionProperty,
                NComboBox.SelectedIndexProperty,
                NComboBox.DropDownStyleProperty,
                NComboBox.WheelNavigationModeProperty
                );

            for (int i = 0; i < editors.Count; i++)
            {
                propertiesStack.Add(editors[i]);
            }

            stack.Add(new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack)));

            // create the events list box
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(stack);
        }
Exemple #8
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            // Add the properties group box
            NList <NPropertyEditor> editors = new NList <NPropertyEditor>(NDesigner.GetDesigner(m_SingleVisiblePanel).CreatePropertyEditors(
                                                                              m_SingleVisiblePanel,
                                                                              NSingleVisiblePanel.EnabledProperty,
                                                                              NSingleVisiblePanel.SizeToVisibleProperty,
                                                                              NSingleVisiblePanel.VisibleIndexProperty
                                                                              ));

            NStackPanel propertiesStack = new NStackPanel();

            for (int i = 0, count = editors.Count; i < count; i++)
            {
                stack.Add(editors[i]);
            }

            NGroupBox propertiesGroupBox = new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack));

            stack.Add(propertiesGroupBox);

            // Add an events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(stack);
        }
Exemple #9
0
        private NTabPage CreateEnumPage()
        {
            NTabPage    page  = new NTabPage("Enum");
            NStackPanel stack = new NStackPanel();

            page.Content = stack;
            stack.HorizontalPlacement = ENHorizontalPlacement.Left;

            NList <NPropertyEditor> editors = SimpleNodeDesigner.CreatePropertyEditors(m_SimpleNode,
                                                                                       NSimpleNode.ComboBoxEnumValueProperty,
                                                                                       NSimpleNode.HRadioGroupEnumProperty,
                                                                                       NSimpleNode.VRadioGroupEnumProperty);

            NGroupBox groupBox = new NGroupBox(editors[0].EditedProperty.ToString());

            stack.Add(groupBox);
            groupBox.Content = editors[0];

            for (int i = 1, count = editors.Count; i < count; i++)
            {
                NPropertyEditor editor = editors[i];
                stack.Add(editor);
            }

            return(page);
        }
Exemple #10
0
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_HueColorBar).CreatePropertyEditors(
                m_HueColorBar,
                NHueColorBar.UpdateWhileDraggingProperty,
                NHueColorBar.SelectedValueProperty,
                NHueColorBar.OrientationProperty,
                NHueColorBar.ValueSelectorExtendPercentProperty
                );

            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            for (int i = 0, editorsCount = editors.Count; i < editorsCount; i++)
            {
                stack.Add(editors[i]);
            }

            // Create an events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Exemple #11
0
        private static async Task OnPlayerCreate(INode node, Nuid id, INList args)
        {
            await node.SetFieldInt(id, Player.Fields.LEVEL, 1100);

            await node.SetFieldString(id, "nick_name", "1sadasdasd");

            await node.AddHeartbeat(id, "test", 10000, 10, OnHeartbeat);

            await node.AddKeyValue(id, Player.Tables.QuestTable.TABLE_NAME, 1001, NList.New().Add(1).Add(TimeUtils.NowMilliseconds));

            await node.AddKeyValue(id, Player.Tables.QuestTable.TABLE_NAME, 2002, NList.New().Add(2).Add(TimeUtils.NowMilliseconds));

            await node.AddKeyValue(id, Player.Tables.QuestTable.TABLE_NAME, 3003, NList.New().Add(3).Add(TimeUtils.NowMilliseconds));

            await node.Create("item", id, NList.New().Add(20001).Add(1));

            await node.Create("item", id, NList.New().Add(20002).Add(2));

            await node.Create("item", id, NList.New().Add(20003).Add(3));

            await node.Create("item", id, NList.New().Add(20004).Add(4));

            await node.Create("item", id, NList.New().Add(20005).Add(5));

            await node.Create("item", id, NList.New().Add(20006).Add(6));

            int status = await node.GetColInt(id, Player.Tables.QuestTable.TABLE_NAME, 1001, Player.Tables.QuestTable.COL_STATUS);
        }
Exemple #12
0
        /// <summary>
        /// Creates the list of books through which the user can browse
        /// </summary>
        private void CreateBooksList()
        {
            m_Books = new NList <NBook>();

            m_Books.Add(new NBook(
                            "The Name Of The Wind",
                            "Patrick Rothfuss",
                            "This is the riveting first-person narrative of Kvothe, a young man who grows to be one of the most notorious magicians his world has ever seen. From his childhood in a troupe of traveling players, to years spent as a near-feral orphan in a crime-riddled city, to his daringly brazen yet successful bid to enter a legendary school of magic, The Name of the Wind is a masterpiece that transports readers into the body and mind of a wizard.",
                            Nevron.Nov.Examples.NResources.Image_Books_NameOfTheWind_jpg,
                            12.90));
            m_Books.Add(new NBook(
                            "Lord of Ohe Rings",
                            "J.R.R. Tolkien",
                            "In ancient times the Rings of Power were crafted by the Elven-smiths, and Sauron, the Dark Lord, forged the One Ring, filling it with his own power so that he could rule all others. But the One Ring was taken from him, and though he sought it throughout Middle-earth, it remained lost to him. After many ages it fell by chance into the hands of the hobbit Bilbo Baggins.",
                            NResources.Image_Books_LordOfTheRings_jpg,
                            13.99));
            m_Books.Add(new NBook(
                            "A Game Of Thrones",
                            "George R.R. Martin",
                            "Long ago, in a time forgotten, a preternatural event threw the seasons out of balance. In a land where summers can last decades and winters a lifetime, trouble is brewing. The cold is returning, and in the frozen wastes to the north of Winterfell, sinister and supernatural forces are massing beyond the kingdom’s protective Wall. At the center of the conflict lie the Starks of Winterfell, a family as harsh and unyielding as the land they were born to.",
                            NResources.Image_Books_AGameOfThrones_jpg,
                            12.79));
            m_Books.Add(new NBook(
                            "The Way Of Kings",
                            "Brandon Sanderson",
                            "Roshar is a world of stone and storms. Uncanny tempests of incredible power sweep across the rocky terrain so frequently that they have shaped ecology and civilization alike. Animals hide in shells, trees pull in branches, and grass retracts into the soilless ground. Cities are built only where the topography offers shelter.",
                            NResources.Image_Books_TheWayOfKings_jpg,
                            7.38));
            m_Books.Add(new NBook(
                            "Mistborn",
                            "Brandon Sanderson",
                            "For a thousand years the ash fell and no flowers bloomed. For a thousand years the Skaa slaved in misery and lived in fear. For a thousand years the Lord Ruler, the 'Sliver of Infinity' reigned with absolute power and ultimate terror, divinely invincible. Then, when hope was so long lost that not even its memory remained, a terribly scarred, heart-broken half-Skaa rediscovered it in the depths of the Lord Ruler’s most hellish prison. Kelsier 'snapped' and found in himself the powers of a Mistborn. A brilliant thief and natural leader, he turned his talents to the ultimate caper, with the Lord Ruler himself as the mark. ",
                            NResources.Image_Books_Mistborn_jpg,
                            6.38));
        }
Exemple #13
0
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_BorderSplitButton).CreatePropertyEditors(
                m_BorderSplitButton,
                NBorderSplitButton.EnabledProperty,
                NBorderSplitButton.HorizontalPlacementProperty,
                NBorderSplitButton.VerticalPlacementProperty,
                NBorderSplitButton.DropDownButtonPositionProperty,
                NBorderSplitButton.HasAutomaticButtonProperty,
                NBorderSplitButton.HasNoneButtonProperty,
                NBorderSplitButton.HasMoreOptionsButtonProperty
                );

            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            for (int i = 0; i < editors.Count; i++)
            {
                stack.Add(editors[i]);
            }

            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_LuminanceColorBar).CreatePropertyEditors(
                m_LuminanceColorBar,
                NLuminanceColorBar.UpdateWhileDraggingProperty,
                NLuminanceColorBar.BaseColorProperty,
                NLuminanceColorBar.SelectedValueProperty,
                NLuminanceColorBar.OrientationProperty,
                NLuminanceColorBar.ValueSelectorExtendPercentProperty
                );

            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            for (int i = 0, editorsCount = editors.Count; i < editorsCount; i++)
            {
                stack.Add(editors[i]);
            }

            // Modify the properties of the selected value property editor
            NSinglePropertyEditor selectedValueEditor = (NSinglePropertyEditor)editors[2];

            selectedValueEditor.Minimum = 0;
            selectedValueEditor.Maximum = 1;
            selectedValueEditor.Step    = 0.01;

            // Create an events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Exemple #15
0
        public async Task Leave(Nuid id)
        {
            Entity entity = EntityManager.Get(id);

            if (entity != null)
            {
                await CallbackEntity(id, EntityEvent.OnLeave, NList.Empty);

                await SyncEntity(id, NList.New().Add(id).Add((int)EntityEvent.OnLeave));
            }
            else
            {
                if (id.Origin == Identity)
                {
                    return;
                }

                INode node = GrainFactory.GetGrain <INode>(id.Origin);

                if (await node.IsActive())
                {
                    await node.Leave(id);
                }
            }
        }
Exemple #16
0
        public void SubtractMultipleLists()
        {
            NList <int> list4    = new NList <int>();
            NList <int> expected = new NList <int>();
            NList <int> list1    = new NList <int>()
            {
                1, 2, 3
            };
            NList <int> list2 = new NList <int>()
            {
                2, 3
            };
            NList <int> list3 = new NList <int>()
            {
                2
            };

            list4    = list1 - list2 - list3;
            expected = new NList <int>()
            {
                1
            };

            CollectionAssert.AreEqual(expected, list4);
        }
Exemple #17
0
        public async Task <Nuid> Create(Nuid id, string type, NList args)
        {
            if (id.Origin != Identity)
            {
                INode node = GrainFactory.GetGrain <INode>(id.Origin);
                return(await node.Create(id, type, args));
            }

            if (NodeType == NodeType.Grain)
            {
                Entity entity = EntityManager.Create(id, type);
                if (entity == null)
                {
                    _Logger.LogError($"{id} Create Entity Failed when {id} {type}!");
                    return(Nuid.Empty);
                }
            }
            else if (NodeType == NodeType.Cache)
            {
                if (!await SetCacheType(id, type))
                {
                    _Logger.LogError($"{id} Create Entity when SetCacheType Failed {id} {type}!");
                    return(Nuid.Empty);
                }
            }

            await CallbackEntity(id, EntityEvent.OnCreate, args);

            return(id);
        }
Exemple #18
0
        private void CreateTreeDiagram(int levels, int branchNodes)
        {
            // create a random tree
            NGenericTreeTemplate tree = new NGenericTreeTemplate();

            tree.EdgesUserClass      = "Connector";
            tree.Balanced            = false;
            tree.Levels              = levels;
            tree.BranchNodes         = branchNodes;
            tree.HorizontalSpacing   = 10;
            tree.VerticalSpacing     = 10;
            tree.VerticesShape       = GetDefaultShapeType();
            tree.VerticesSize        = GetDefaultShapeSize();
            tree.VertexSizeDeviation = 1;
            tree.Create(m_DrawingDocument);

            // randomly set the children placement of ten shapes to col
            NList <NShape> shapes = m_DrawingDocument.Content.ActivePage.GetShapes(false, NDiagramFilters.ShapeType2D);
            Random         random = new Random();

            for (int i = 0; i < shapes.Count / 2; i++)
            {
                int    index = random.Next(shapes.Count);
                NShape shape = shapes[index];
                shape.Geometry.Fill = new NColorFill(NColor.Orange);
                shape.LayoutData.TipOverChildrenPlacement = ENTipOverChildrenPlacement.ColRight;
            }
        }
Exemple #19
0
        protected override async void ChannelRead0(IChannelHandlerContext ctx, WebSocketFrame frame)
        {
            try
            {
                if (frame is PingWebSocketFrame)
                {
                    await ctx.WriteAsync(new PongWebSocketFrame((IByteBuffer)frame.Content.Retain()));

                    return;
                }

                if (frame is TextWebSocketFrame textFrame)
                {
                    var json = textFrame.Text();
                    if (json.StartsWith("throw ", StringComparison.OrdinalIgnoreCase))
                    {
                        throw new Exception(json.Substring(6, json.Length - 6));
                    }

                    NList recv_msg = JsonUtils.ToObject <NList>(json);
                    await _Session.IncomingMessage(recv_msg);

                    return;
                }
            }
            catch (Exception ex)
            {
                _Logger.LogError(ex, "ChannelRead0 error");
            }
        }
        /// <summary>
        /// スネークケースに変換する。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string CamelToSnake(string str, bool isUpper = false)
        {
            var charList = new NList <char>();

            foreach (var item in str)
            {
                charList.Add(item);
            }
            int index  = 1;
            var target = new NList <char>();

            for (int i = 0; i < charList.Count; i++)
            {
                var item     = charList[i];
                var nextItem = (charList.Count > i + 1)? charList[i + 1] : new char();
                target.Add(item);
                if (!charList.IsLast(item) && abcUpperList.Contains(nextItem))
                {
                    target.Insert(index, '_');
                    index++;
                }
                index++;
            }
            var res = new string(target.ToArray());

            return(isUpper ? res.ToUpper()
                : res.ToLower()
                   );
        }
Exemple #21
0
        private async Task OnRecv_Custom(NList msg)
        {
            int   custom_msg = msg.Get <int>(0);
            NList args       = msg.GetRange(1, msg.Count - 1);

            await NModule.CallbackCustom(_RoleNode, _RoleId, custom_msg, args);
        }
Exemple #22
0
        /// <summary>
        /// Called when the user presses clear highlight button
        /// </summary>
        /// <param name="arg"></param>
        void OnClearHighlightButtonClick(NEventArgs arg)
        {
            NList <NNode> shapes = m_DrawingView.Drawing.GetDescendants(NShape.NShapeSchema);

            for (int i = 0; i < shapes.Count; i++)
            {
                NShape shape = (NShape)shapes[i];

                NRangeTextElement rootTextElement = (NRangeTextElement)shape.GetTextBlockContentNoCreate();

                if (rootTextElement == null)
                {
                    continue;
                }

                rootTextElement.VisitRanges(delegate(NRangeTextElement range)
                {
                    NInline inline = range as NInline;

                    if (inline != null)
                    {
                        inline.ClearLocalValue(NInline.HighlightFillProperty);
                    }
                });
            }
        }
Exemple #23
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            // Transform Properties
            {
                NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_TransformContent).CreatePropertyEditors(
                    m_TransformContent,
                    NTransformContent.ScaleXProperty,
                    NTransformContent.ScaleYProperty,
                    NTransformContent.AngleProperty,
                    NTransformContent.StretchAtRightAnglesProperty,
                    NTransformContent.HorizontalPlacementProperty,
                    NTransformContent.VerticalPlacementProperty
                    );

                NStackPanel propertiesStack = new NStackPanel();
                for (int i = 0; i < editors.Count; i++)
                {
                    propertiesStack.Add(editors[i]);
                }

                stack.Add(new NGroupBox("Transform Content Properties", propertiesStack));
            }

            return(stack);
        }
        public async Task Init()
        {
            HttpResponseMessage IzlazistavkeResponse;

            IzlazistavkeResponse = izlaziStavkeService.GetActionResponseID("GetIzlazStavkeCustom", Izlazhlp.IzlazID);
            List <IzlazStavke> aktivne = IzlazistavkeResponse.Content.ReadAsAsync <List <IzlazStavke> >().Result;

            foreach (var x in aktivne)
            {
                Izlazhlp.IzlazStavke.Add(x);
            }
            foreach (var y in Izlazhlp.IzlazStavke)
            {
                HttpResponseMessage list;
                list = proizvodiService.GetActionResponseID("GetProizvodiCustom", y.ProizvodID);
                Proizvodi Proizvod = list.Content.ReadAsAsync <Proizvodi>().Result;


                NList.Add(Proizvod);
            }
            HttpResponseMessage list2;

            list2 = ambalazaService.GetResponse();
            List <Ambalaza> vplist = list2.Content.ReadAsAsync <List <Ambalaza> >().Result;

            AmbList.Add(new Ambalaza {
                AmbalazaId = 0, Naziv = "Odaberite stavku"
            });
            foreach (var item in vplist)
            {
                AmbList.Add(item);
            }
        }
Exemple #25
0
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_Tab).CreatePropertyEditors(
                m_Tab,
                NTab.EnabledProperty,
                NTab.SizeToSelectedPageProperty,
                NTab.HeadersPositionProperty,
                NTab.HeadersModeProperty,
                NTab.HeadersAlignmentProperty,
                NTab.HeadersSpacingProperty,
                NTab.HorizontalPlacementProperty,
                NTab.VerticalPlacementProperty);

            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            for (int i = 0; i < editors.Count; i++)
            {
                stack.Add(editors[i]);
            }

            // create the events list box
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Exemple #26
0
        static NCalendarExample()
        {
            NCalendarExampleSchema = NSchema.Create(typeof(NCalendarExample), NExampleBase.NExampleBaseSchema);

            // Fill the list of cultures
            string[] cultureNames = new string[] { "en-US", "en-GB", "fr-FR", "de-DE", "es-ES", "ru-RU", "zh-CN", "ja-JP",
                                                   "it-IT", "hi-IN", "ar-AE", "he-IL", "id-ID", "ko-KR", "pt-BR", "sv-SE", "tr-TR", "pt-BR", "bg-BG", "ro-RO",
                                                   "pl-PL", "nl-NL", "cs-CZ" };
            Cultures = new NList <CultureInfo>();

            for (int i = 0, count = cultureNames.Length; i < count; i++)
            {
                CultureInfo cultureInfo;
                try
                {
                    cultureInfo = new CultureInfo(cultureNames[i]);
                }
                catch
                {
                    cultureInfo = null;
                }

                if (cultureInfo != null && Cultures.Contains(cultureInfo) == false)
                {
                    Cultures.Add(cultureInfo);
                }
            }

            // Sort the cultures by their English name
            Cultures.Sort(new NCultureNameComparer());
        }
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            // properties
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_CheckBox).CreatePropertyEditors(
                m_CheckBox,
                NCheckBox.EnabledProperty,
                NCheckBox.CheckedProperty,
                NCheckBox.IndeterminateProperty,
                NCheckBox.SymbolContentRelationProperty);

            NStackPanel propertiesStack = new NStackPanel();

            for (int i = 0; i < editors.Count; i++)
            {
                propertiesStack.Add(editors[i]);
            }

            stack.Add(new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack)));

            // events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(stack);
        }
        public void AddMoreThan10Items()
        {
            int num1  = 1;
            int num2  = 2;
            int num3  = 3;
            int num4  = 4;
            int num5  = 5;
            int num6  = 6;
            int num7  = 7;
            int num8  = 8;
            int num9  = 9;
            int num10 = 10;
            int num11 = 11;

            NList <int> nums = new NList <int>();

            nums.Add(num1);
            nums.Add(num2);
            nums.Add(num3);
            nums.Add(num4);
            nums.Add(num5);
            nums.Add(num6);
            nums.Add(num7);
            nums.Add(num8);
            nums.Add(num9);
            nums.Add(num10);
            nums.Add(num11);

            Assert.AreEqual(num11, nums[10]);
        }
Exemple #29
0
        public async Task <T> GetRowCol <T>(Nuid id, string table_name, long row, int col)
        {
            Entity entity = EntityManager.Get(id);

            if (entity != null)
            {
                Table table = entity.GetTable(table_name);
                if (table == null)
                {
                    return(default(T));
                }

                return(table.GetRowCol <T>(row, col));
            }
            else
            {
                if (id.Origin == Identity)
                {
                    NList row_value = await GetCacheRowValue(id, table_name, row);

                    return(row_value.Get <T>(col));
                }
                else
                {
                    INode node = GrainFactory.GetGrain <INode>(id.Origin);
                    return(await node.GetRowCol <T>(id, table_name, row, col));
                }
            }
        }
Exemple #30
0
        private async Task SetKeyCol <TColValue, TPrimaryKey>(Nuid id, string table_name, TPrimaryKey primary_key, int col, TColValue col_value)
        {
            if (col_value == null)
            {
                _Logger.LogError($"{id} SetKeyCol {table_name} {primary_key}_{col} when col_value is null!");
                return;
            }

            if (NodeType == NodeType.Grain)
            {
                Entity entity = EntityManager.Get(id);
                if (entity == null)
                {
                    _Logger.LogError($"{id} SetKeyCol {table_name} {primary_key}_{col} when Grain dont found entity!");
                    return;
                }

                Table <TPrimaryKey> table = entity.GetTable(table_name) as Table <TPrimaryKey>;
                if (table == null)
                {
                    _Logger.LogError($"{id} SetKeyCol {table_name} {primary_key}_{col} when Grain dont found field!");
                    return;
                }

                NList result;
                if (!table.TrySetKeyCol(primary_key, col, col_value, out result))
                {
                    _Logger.LogError($"{id} SetKeyCol {table_name} {primary_key}_{col} when {col_value} TrySetRowCol failed!");
                    return;
                }

                await CallbackTable(id, table_name, TableEvent.SetCol, result);
            }
            else if (NodeType == NodeType.Cache)
            {
                NList value = await GetCacheTableKeyValue(id, table_name, primary_key);

                TColValue old_value = value.Get <TColValue>(col);
                if (old_value.Equals(col_value))
                {
                    _Logger.LogError($"{id} SetKeyCol {table_name} {primary_key}_{col} when new=old SetCacheRow failed!");
                }

                value.Set(col, col_value);

                if (!await SetCacheTableKeyValue(id, table_name, primary_key, value))
                {
                    _Logger.LogError($"{id} SetKeyCol {table_name} {primary_key}_{col} when {value} SetCacheTableKeyValue failed!");
                    return;
                }

                NList result = NList.New();
                result.Add(primary_key);
                result.Add(col);
                result.Add(old_value);
                result.Add(col_value);

                await CallbackTable(id, table_name, TableEvent.SetCol, result);
            }
        }