コード例 #1
0
 public override JsArray<Translation> synchronousTranslate(JsString domain, JsArray<JsString> keys)
 {
     if (HtmlContext.window.console != null) {
         HtmlContext.console.log("Requested to translate: " + domain + " " + keys);
     }
     return new JsArray<Translation>();
 }
コード例 #2
0
        public override void init(angularScope scope, angularHttp http, angularLocation loc, angularFilter filter)
        {
            base.init(scope, http, loc, filter);
            ngItems = new JsArray<JsArray<ngHistoryEntry>>();

            eventManager.inst.subscribe(eventManager.settingsLoaded, delegate(int n) { requestRefreshPropousals(null); });
        }
コード例 #3
0
ファイル: Template.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var today = new JsDate();
            var birthdays = new JsArray<JsNumber> {
                new JsDate(today.getFullYear(), today.getMonth(), 11).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 6).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 27).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 1, 3).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 2, 22).valueOf()
 
            };
                    new jQuery("#datepicker").kendoDatePicker(new DatePickerConfiguration {
                        value = today,
                        month=  new MonthConfiguration {
                            // template for dates in month view
                            content = "# if ($.inArray(+data.date, [" + birthdays + "]) != -1) { #" +
                                         "<div class='birthday'></div>" +
                                     "# } #" +
                                     "#= data.value #"
                        },
                        footer = "Today - #=kendo.toString(data, 'd') #"
                    });

                    new jQuery("#datepicker").data("kendoDatePicker").As<DatePicker>();
                                    //TODO: .dateView.calendar.element
                                    //.width(300);
                

        }
コード例 #4
0
ファイル: Class2.cs プロジェクト: fjgandrade/sharpkit
        void foo()
        {
            var list = new JsArray<object>();
            list.push(new object[7]);
            list.push(new byte[7]);
            list.push(new short[7]);
            list.push(new ushort[7]);
            list.push(new int[7]);
            list.push(new uint[7]);
            list.push(new float[7]);
            list.push(new double[7]);

            var blubb = new object[] { 7, 8, 9 };

            list.push(new object[] { 7, 8, 9 });
            list.push(new byte[] { 77, 8, 9 });
            list.push(new short[] { 7, 8, 9 });
            list.push(new ushort[] { 7, 8, 9 });
            list.push(new int[] { 7, 8, 9 });
            list.push(new uint[] { 7, 8, 9 });
            list.push(new float[] { 7, 8, 9 });
            list.push(new double[] { 7, 8, 9 });


            list.push(new[] { 7, 8, 9 });
            list.push(new[] { 7.7, 8.8, 9.9 });
            list.push(new[] { 7d, 8d, 9d });

            int[] a = { 0, 2, 4, 6, 8 };

        }
コード例 #5
0
        public override JsArray<Translation> synchronousTranslate(JsString domain, JsArray<JsString> keys)
        {
            if (!fileLoaded) {
                makeSynchronousRequest( url );
            }

            return provideTranslations(domain, keys);
        }
コード例 #6
0
        public override void init(angularScope scope, angularHttp http, angularLocation loc, angularFilter filter)
        {
            base.init(scope, http, loc, filter);
            ngHistoryItems = new JsArray<ngHistoryGroupEntry>();

            eventManager.inst.subscribe(eventManager.settingsLoaded, delegate(int n) { refreshHistory(); });

            eventManager.inst.subscribe(eventManager.orderCompleted, delegate(int n) { refreshHistory(); });
        }
コード例 #7
0
        public ViewStack(ContentLoader contentLoader, ContentParser contentParser, DomWalker domWalker, ViewChangeAnimator viewChangeAnimator)
        {
            this.contentLoader = contentLoader;
            this.contentParser = contentParser;
            this.viewChangeAnimator = viewChangeAnimator;
            this.domWalker = domWalker;

            viewFragmentStack = new JsArray<jQuery>();
        }
コード例 #8
0
ファイル: Api.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var data = new JsArray<DropDownListConfiguration> { 
                        new DropDownListConfiguration {text = "The Shawshank Redemption", value ="1"},
                        new DropDownListConfiguration {text = "The Godfather", value ="2"},
                        new DropDownListConfiguration {text = "The Godfather = Part II", value ="3"},
                        new DropDownListConfiguration {text = "Il buono, il brutto, il cattivo.", value ="4"},
                        new DropDownListConfiguration {text = "Pulp Fiction", value ="5"},
                        new DropDownListConfiguration {text = "12 Angry Men", value ="6"},
                        new DropDownListConfiguration {text = "Schindler's List", value ="7"},
                        new DropDownListConfiguration {text = "One Flew Over the Cuckoo's Nest", value ="8"},
                        new DropDownListConfiguration {text = "Inception", value ="9"},
                        new DropDownListConfiguration {text = "The Dark Knight", value ="10"}
              };

            new jQuery("#products").kendoDropDownList(new DropDownListConfiguration
            {
                dataTextField = "text",
                dataValueField = "value",
                dataSourceObject = data
            })
                          .closest(".k-widget")
                          .attr("id", "products_wrapper");

            var dropdownlist = new jQuery("#products").data("kendoDropDownList").As<DropDownList>();
            JsAction<Event> setValue = e =>
            {
                if (e.type != "keypress" || Kendo.keys.ENTER == e.keyCode)
                    dropdownlist.value(new jQuery("#value").val().As<JsString>());
            },
            setIndex = e =>
            {
                if (e.type != "keypress" || Kendo.keys.ENTER == e.keyCode)
                {
                    var index = int.Parse(new jQuery("#index").val().As<JsString>());
                    dropdownlist.select(index);
                }
            },
            setSearch = e =>
            {
                if (e.type != "keypress" || Kendo.keys.ENTER == e.keyCode)
                    dropdownlist.search(new jQuery("#word").val().As<JsString>());
            };

            new jQuery("#enable").click(() => dropdownlist.enable());
            new jQuery("#disable").click(() =>dropdownlist.enable(false));
            new jQuery("#open").click(() => dropdownlist.open());
            new jQuery("#close").click(() => dropdownlist.close());
            new jQuery("#getValue").click(() => HtmlContext.window.alert(dropdownlist.value()));
            new jQuery("#getText").click(() => HtmlContext.window.alert(dropdownlist.text()));
            new jQuery("#setValue").click(setValue);
            new jQuery("#value").keypress(setValue);
            new jQuery("#select").click(setIndex);
            new jQuery("#index").keypress(setIndex);
            new jQuery("#find").click(setSearch);
            new jQuery("#word").keypress(setSearch);
        }
コード例 #9
0
        public JsArray<JsString> getAllRandoriSelectorEntries()
        {
            var allEntries = new JsArray<JsString>();

            foreach (var cssSelector in hashMap) {
                allEntries.push(cssSelector);
            }

            return allEntries;
        }
コード例 #10
0
        public JsArray<JsString> getCachedFileList()
        {
            JsArray<JsString> contentList = new JsArray<JsString>();
            foreach (JsString key in ContentCache.htmlMergedFiles)
            {
                contentList.Add(key);
            }

            return contentList;
        }
コード例 #11
0
        public void refreshHistory()
        {
            ajaxHlp.inst.SendGet("json",
                HistoryUrl.c_sHistoryPrefix + "/" + ngAppController.inst.ngUserId + "/",
                delegate(object o, JsString s, jqXHR arg3) {
                    ngHistoryItems = o.As<JsArray<ngHistoryGroupEntry>>();

                    _scope.apply();
                }, onRequestFailed);
        }
コード例 #12
0
ファイル: jsUtils.cs プロジェクト: mgerasika/gam-gam
 public bool Contains(JsArray<string> ngCategories, string p)
 {
     bool res = false;
     foreach (string str in ngCategories) {
         if (str == p) {
             res = true;
             break;
         }
     }
     return res;
 }
コード例 #13
0
ファイル: JsCompiler.cs プロジェクト: fjgandrade/sharpkit
        private static void Compile_Phase1()
        {
            foreach (var action in BeforeCompilationFunctions)
                action();
            BeforeCompilationFunctions = new JsArray<JsAction>();
            for (var i = 0; i < JsTypes.length; i++)
            {
                var jsType = JsTypes[i];
                var fullName = jsType.fullname;
                var type = Types[fullName].As<JsType>();
                if (type == null)
                {
                    Types[fullName] = jsType;
                }
                else
                {
                    jsType.isPartial = true;
                    jsType.realType = type;
                }
                if (jsType.derivedTypes == null)
                    jsType.derivedTypes = new JsArray<JsType>();
                if (jsType.interfaces == null)
                    jsType.interfaces = new JsArray<JsType>();
                if (jsType.definition == null)
                    jsType.definition = new JsObject();

                var index = fullName.As<JsString>().lastIndexOf(".");
                if (index == -1)
                {
                    jsType.name = fullName;
                }
                else
                {
                    jsType.name = fullName.As<JsString>().substring(index + 1);
                    jsType.ns = fullName.As<JsString>().substring(0, index);
                }

                if (jsType.Kind == JsTypeKind.Enum)
                {
                    if (jsType.baseTypeName == null)
                        jsType.baseTypeName = "System.Object";
                    if (jsType.definition["ToString"] == null)
                        jsType.definition["ToString"] = new JsFunction("return this._Name;");
                }
                else if (jsType.Kind == JsTypeKind.Struct)
                {
                    if (type.baseTypeName == null)
                        type.baseTypeName = "System.ValueType";
                }

            }
        }
コード例 #14
0
ファイル: jsCommonUtils.cs プロジェクト: mgerasika/gam-gam
 public bool contains(JsArray<string> prefixes, string prefix)
 {
     bool res = false;
     foreach (string pr in prefixes)
     {
         if (pr == prefix)
         {
             res = true;
             break;
         }
     }
     return res;
 }
コード例 #15
0
ファイル: CustomData.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var projects = new JsArray<AutocompleteItem>
            {
                new AutocompleteItem
                {
                    value= "jquery",
                    label= "jQuery",
                    desc= "the write less, do more, JavaScript library",
                    icon= "jquery_32x32.png"
                },
                new AutocompleteItem 
                {
                    value= "jquery-ui",
                    label= "jQuery UI",
                    desc= "the official user interface library for jQuery",
                    icon= "jqueryui_32x32.png"
                },
                new AutocompleteItem 
                {
                    value = "sizzlejs",
                    label = "Sizzle JS",
                    desc = "a pure-JavaScript CSS selector engine",
                    icon = "sizzlejs_32x32.png"
                }
            };
            new jQuery("#project").autocomplete(new AutocompleteOptions
            {
                source = projects,
                focus = (e, ui) =>
                    {
                        var ui2 = ui.As<UIWithItem>();
                        new jQuery("#project").val(ui2.item.label);
                        JsContext.JsCode(" new jQuery( '#project' ).val(ui.item.label)");
                        JsContext.@return(false);
                    },
                select = (e, ui) =>
                    {
                        new jQuery("#project").val(ui.As<UIWithItem>().item.label);
                        new jQuery("#project-id").val(ui.As<UIWithItem>().item.value);
                        new jQuery("#project-description").html(ui.As<UIWithItem>().item.As<AutocompleteItem>().desc);
                        new jQuery("#project-icon").attr("src", "images/" + ui.As<UIWithItem>().item.As<AutocompleteItem>().icon);
                        JsContext.@return(false);
                    }
            }).data("autocomplete").As<UIWithItem>()._renderItem = (ul, item) =>

                    new jQuery("<li></li>")
                        .data("item.autocomplete", item)
                        .append("<a>" + item.label + "<br>" + item.desc + "</a>")
                        .appendTo(ul);
        }
コード例 #16
0
ファイル: JsCompiler.cs プロジェクト: fjgandrade/sharpkit
 private static void Compile_Phase2()
 {
     for (var i = 0; i < JsTypes.length; i++)
     {
         var jsType = JsTypes[i];
         Compile_Phase2_TmpType(jsType);
     }
     foreach (var ce in JsTypes)
     {
         if (ce.cctor != null)
             ce.cctor.As<JsAction>()();
     }
     JsTypes = new JsArray<JsType>();
 }
コード例 #17
0
ファイル: PropertyInfo.cs プロジェクト: fjgandrade/sharpkit
		//[JsMethod(UseNativeOverloads = true)]
		public void SetValue(object obj, object value, object[] indexes)
		{
			if (_Setter == null)
				throw new Exception("Property " + _Name + " doesn't have a setter");
			if (indexes == null || indexes.Length == 0)
			{
				_Setter.call(obj, value);
			}
			else
			{
				var arr = new JsArray(indexes);
				arr.push(value);
				_Setter.apply(obj, indexes ?? new JsArray().As<object[]>());
			}
		}
コード例 #18
0
ファイル: Canvas.cs プロジェクト: fjgandrade/sharpkit
 void buildSpinner(SpinnerData sd)
 {
     spinnerData = sd;
     var canvas = document.getElementsByTagName("canvas")[0].As<HTMLCanvasElement>();
     ctx = canvas.getContext("2d").As<CanvasRenderingContext2D>();
     index = 0;
     degrees = spinnerData.degrees;
     degreesList = new JsArray<JsNumber>();
     for (var x = 0; x < degrees; x++)
         degreesList.push(x);
     // reset
     index = 0;
     // so I can kill it later
     canvasTimer = setInterval(draw, 1000 / degrees);
 }
コード例 #19
0
        public override JsArray<Translation> synchronousTranslate(JsString domain, JsArray<JsString> keys)
        {
            var domainKeys = translations[domain];
            var response = new JsArray<Translation>();

            if ( domainKeys != null ) {
                for ( var i=0; i<keys.length;i++) {
                    var translation = new Translation();
                    translation.key = keys[i];
                    translation.value = domainKeys[keys[i]];
                    response.push(translation);
                }
            }

            return response;
        }
コード例 #20
0
ファイル: ngFoodFilter.cs プロジェクト: mgerasika/gam-gam
        public override object filter(JsObject obj, JsObject arg)
        {
            JsArray<ngFoodItem> res = new JsArray<ngFoodItem>();

            string category = arg["category"].As<JsString>();
            int day = arg["day"].As<int>();
            JsArray<JsArray<ngFoodItem>> allFoods = obj.As<JsArray<JsArray<ngFoodItem>>>();
            JsArray<ngFoodItem> items = allFoods[day];
            if (null != items) {
                foreach (ngFoodItem item in items) {
                    if ((item.Category == category) && !item.isContainer) {
                        res.Add(item);
                    }
                }
            }
            return res;
        }
コード例 #21
0
ファイル: ngOrderFilter.cs プロジェクト: mgerasika/gam-gam
        public override object filter(JsObject obj, JsObject arg)
        {
            JsArray<ngOrderEntry> res = new JsArray<ngOrderEntry>();
            int day = arg["day"].As<int>();
            JsArray<JsArray<ngOrderEntry>> allOrders = obj.As<JsArray<JsArray<ngOrderEntry>>>();
            JsArray<ngOrderEntry> tmp = allOrders[day];
            if (tmp != null && tmp.length > 0) {
                foreach (ngOrderEntry order in tmp) {
                    ngFoodItem foodItem = ngFoodController.inst.findFoodById(order.FoodId);
                    if (null != foodItem && !foodItem.isContainer) {
                        res.Add(order);
                    }
                }
            }

            return res;
        }
コード例 #22
0
 public override void translate(JsString domain, JsArray<JsString> keys)
 {
     if (!fileLoaded) {
         makeAsynchronousRequest(url, delegate() {
             //The data is back, translate
             JsArray<Translation> translations = provideTranslations(domain, keys);
             if (translationResult != null ) {
                 translationResult(domain, translations);
             }
         } );
     } else {
         //We already have the file, so just translate
         JsArray<Translation> translations = provideTranslations(domain, keys);
         if (translationResult != null) {
             translationResult(domain, translations);
         }
     }
 }
コード例 #23
0
ファイル: Events.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var data = new JsArray<DropDownListConfiguration> {
                new DropDownListConfiguration {text = "Item1", value ="1"},
                new DropDownListConfiguration{text = "Item2", value ="2"},
                new DropDownListConfiguration{text = "Item3", value ="3"}
            };

                    new jQuery("#input").kendoDropDownList(new DropDownListConfiguration {
                        dataTextField = "text",
                        dataValueField = "value",
                        dataSourceObject = data,
                        select = onSelect,
                        change = onChange,
                        close = onClose,
                        open = onOpen
                    });
        }
コード例 #24
0
ファイル: Api.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var data = new JsArray<ComboBoxConfiguration> {
                new ComboBoxConfiguration     { text = "12 Angry Men", value = "1" },
                new ComboBoxConfiguration{ text = "Il buono, il brutto, il cattivo.", value = "2" },
                new ComboBoxConfiguration{ text = "Inception", value = "3" },
                new ComboBoxConfiguration{ text = "One Flew Over the Cuckoo's Nest", value = "4" },
                new ComboBoxConfiguration{ text = "Pulp Fiction", value = "5" },
                new ComboBoxConfiguration{ text = "Schindler's List", value = "6" },
                new ComboBoxConfiguration { text = "The Dark Knight", value = "7" },
                new ComboBoxConfiguration{ text = "The Godfather", value = "8" },
                new ComboBoxConfiguration{ text = "The Godfather = Part II", value = "9" },
                new ComboBoxConfiguration{ text = "The Shawshank Redemption", value = "10" },
                new ComboBoxConfiguration{ text = "The Shawshank Redemption 2", value = "11" }
        };
            new jQuery("#products").kendoComboBox(new ComboBoxConfiguration
            {
                dataTextField = "text",
                dataValueField = "value",
                dataSourceObject = data
            })
            .closest(".k-widget")
            .attr("id", "products_wrapper");
            
            new jQuery("#filter").kendoDropDownList(new DropDownListConfiguration
            {
                change = filterTypeOnChanged

            });
            combobox = new jQuery("#products").data("kendoComboBox").As<ComboBox>();
          
            new jQuery("#enable").click(() => combobox.enable());
            new jQuery("#disable").click(() => combobox.enable(false));
            new jQuery("#open").click(() => combobox.open());
            new jQuery("#close").click(() => combobox.close());
            new jQuery("#getValue").click(() => HtmlContext.window.alert(combobox.value()));
            new jQuery("#getText").click(() => HtmlContext.window.alert(combobox.value()));
            new jQuery("#setValue").click(setValue);
            new jQuery("#value").keypress(setValue);
            new jQuery("#select").click(setIndex);
            new jQuery("#index").keypress(setIndex);
            new jQuery("#find").click(setSearch);
            new jQuery("#word").keypress(setSearch);
        }
コード例 #25
0
        public static object clone(object obj)
        {
            if ( ( obj == null) || ( JsContext.@typeof( obj ) != "object" ) ) {
                return obj;
            }

            //Dates
            if ( obj is JsDate ) {
                var copy = new JsDate();
                copy.setTime( obj.As<JsDate>().getTime() );
                return copy;
            }

            //Array
            if (obj is JsArray) {
                var copy = new JsArray();
                var current = obj.As<JsArray>();

                for (var i = 0; i < current.length; i++ ) {
                    copy[ i ] = clone( current[ i ] );
                }

                return copy;
            }

            //Object
            if (obj is JsObject) {
                var copy = new JsObject();
                var current = obj.As<JsObject>();

                foreach (var key in current ) {
                    if ( current.hasOwnProperty( key )) {
                        copy[ key ] = clone( current[ key ] );
                    }
                }

                return copy;
            }

            return null;
        }
コード例 #26
0
ファイル: Template.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var today = new JsDate();
            var birthdays = new JsArray<JsNumber> {
                new JsDate(today.getFullYear(), today.getMonth(), 8).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth(), 12).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth(), 24).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 6).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 7).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 25).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() + 1, 27).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 1, 3).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 1, 5).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 2, 22).valueOf(),
                new JsDate(today.getFullYear(), today.getMonth() - 2, 27).valueOf()
            };
            new jQuery("#calendar").kendoCalendar(new CalendarConfiguration
            {
                value = today,
                dates = birthdays,
                month = new MonthConfiguration
                {
                    // template for dates in month view
                    content = "# if ($.inArray(+data.date, data.dates) != -1) { #" +
                                        "<div class='" +
                                           "# if (data.value < 10) { #" +
                                               "exhibition" +
                                           "# } else if ( data.value < 20 ) { #" +
                                               "party" +
                                           "# } else { #" +
                                               "cocktail" +
                                           "# } #" +
                                        "'></div>" +
                                     "# } #" +
                                     "#= data.value #"

                },
                footer = "Today - #=kendo.toString(data, 'd') #"
            });
        }
コード例 #27
0
ファイル: Index.cs プロジェクト: fjgandrade/sharpkit
 static void OnReady()
 {
     // create a template using the above definition
     var template = Kendo.template(new jQuery("#template").html());
     var movies = new JsArray<Movie> {
         new Movie { rank = 1, rating = 9.2, year = 1994, title = "The Shawshank Redemption" },
         new Movie { rank = 2, rating = 9.2, year = 1972, title = "The Godfather" },
         new Movie { rank = 3, rating = 9, year = 1974, title = "The Godfather = Part II" },
         new Movie { rank = 4, rating = 8.9, year = 1966, title = "Il buono, il brutto, il cattivo." },
         new Movie { rank = 5, rating = 8.9, year = 1994, title = "Pulp Fiction" },
         new Movie { rank = 6, rating = 8.9, year = 1957, title = "12 Angry Men" },
         new Movie { rank = 7, rating = 8.9, year = 1993, title = "Schindler's List" },
         new Movie { rank = 8, rating = 8.8, year = 1975, title = "One Flew Over the Cuckoo's Nest" },
         new Movie { rank = 9, rating = 8.8, year = 2010, title = "Inception" },
         new Movie { rank = 10, rating = 8.8, year = 2008, title = "The Dark Knight" } 
     };
     var dataSource = new DataSource(new DataSourceConfiguration
     {
         data = movies,
         change = () => new jQuery("#movies tbody").html(Kendo.render(template, [email protected]<DataSource>().view()))
     });
     dataSource.read();
 }
コード例 #28
0
 /// <summary>
 /// Inserts items in to an array. ...
 /// </summary>
 public static JsArray insert(JsArray array, JsNumber index, JsArray items)
 {
     return(null);
 }
コード例 #29
0
 public JsArrayEnumerator(JsArray <T> list)
 {
     List      = list;
     Index     = -1;
     ListCount = list.length;
 }
コード例 #30
0
 /// <summary>
 /// Returns a shallow copy of a part of an array. ...
 /// </summary>
 public static JsArray slice(JsArray array, JsNumber begin, JsNumber end)
 {
     return(null);
 }
コード例 #31
0
 /// <summary>
 /// Merge multiple arrays into one with unique items. ...
 /// </summary>
 public static JsArray merge(JsArray array1, JsArray array2, JsArray etc)
 {
     return(null);
 }
コード例 #32
0
 /// <summary>
 /// Push an item into the array only if the array doesn't contain it yet ...
 /// </summary>
 public static object include(JsArray array, object item)
 {
     return(null);
 }
コード例 #33
0
 /// <summary>
 /// Iterates an array and invoke the given callback function for each item. ...
 /// </summary>
 public static object forEach(JsArray array, JsAction fn, object scope)
 {
     return(null);
 }
コード例 #34
0
 /// <summary>
 /// Checks whether or not the given array contains the specified item ...
 /// </summary>
 public static bool contains(JsArray array, object item)
 {
     return(false);
 }
コード例 #35
0
        /**
         * Block for getting element at index.
         * @this Blockly.Block
         */
        public override void init()
        {
            var MODE = new JsArray <DropdownItemInfo> {
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_GET, "GET"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_GET_REMOVE, "GET_REMOVE"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_REMOVE, "REMOVE")
            };

            this.WHERE_OPTIONS = new JsArray <DropdownItemInfo> {
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_FROM_START, "FROM_START"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_FROM_END, "FROM_END"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_FIRST, "FIRST"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_LAST, "LAST"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_RANDOM, "RANDOM")
            };
            this.setHelpUrl(Msg.LISTS_GET_INDEX_HELPURL);
            this.setColour(Lists.HUE);
            var modeMenu = new FieldDropdown(MODE, (field, value) => {
                var isStatement = (value == "REMOVE");
                this.updateStatement_(isStatement);
                return(Script.Undefined);
            });

            this.appendValueInput("VALUE")
            .setCheck("Array")
            .appendField(Msg.LISTS_GET_INDEX_INPUT_IN_LIST);
            this.appendDummyInput()
            .appendField(modeMenu, "MODE")
            .appendField("", "SPACE");
            this.appendDummyInput("AT");
            if (!String.IsNullOrEmpty(Msg.LISTS_GET_INDEX_TAIL))
            {
                this.appendDummyInput("TAIL")
                .appendField(Msg.LISTS_GET_INDEX_TAIL);
            }
            this.setInputsInline(true);
            this.setOutput(true);
            this.updateAt_(true);
            // Assign "this" to a variable for use in the tooltip closure below.
            var thisBlock = this;

            this.setTooltip(new Func <string>(() => {
                var mode    = thisBlock.getFieldValue("MODE");
                var where   = thisBlock.getFieldValue("WHERE");
                var tooltip = "";
                switch (mode + " " + where)
                {
                case "GET FROM_START":
                case "GET FROM_END":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;
                    break;

                case "GET FIRST":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;
                    break;

                case "GET LAST":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;
                    break;

                case "GET RANDOM":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;
                    break;

                case "GET_REMOVE FROM_START":
                case "GET_REMOVE FROM_END":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;
                    break;

                case "GET_REMOVE FIRST":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;
                    break;

                case "GET_REMOVE LAST":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;
                    break;

                case "GET_REMOVE RANDOM":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;
                    break;

                case "REMOVE FROM_START":
                case "REMOVE FROM_END":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;
                    break;

                case "REMOVE FIRST":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;
                    break;

                case "REMOVE LAST":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;
                    break;

                case "REMOVE RANDOM":
                    tooltip = Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM;
                    break;
                }
                if (where == "FROM_START" || where == "FROM_END")
                {
                    var msg = (where == "FROM_START") ?
                              Msg.LISTS_INDEX_FROM_START_TOOLTIP :
                              Msg.LISTS_INDEX_FROM_END_TOOLTIP;
                    tooltip += "  " + msg.Replace("%1",
                                                  thisBlock.workspace.options.oneBasedIndex ? "#1" : "#0");
                }
                return(tooltip);
            }));
        }
コード例 #36
0
 /// <summary>
 /// Merge multiple arrays into one with unique items. ...
 /// </summary>
 public static JsArray union(JsArray array1, JsArray array2, JsArray etc)
 {
     return(null);
 }
コード例 #37
0
 /// <summary>
 /// Returns a new array with unique items ...
 /// </summary>
 public static JsArray unique(JsArray array)
 {
     return(null);
 }
コード例 #38
0
 /// <summary>
 /// Clone a flat array without referencing the previous one. ...
 /// </summary>
 public static JsArray clone(JsArray array)
 {
     return(null);
 }
コード例 #39
0
 /// <summary>
 /// Removes the specified item from the array if it exists ...
 /// </summary>
 public static JsArray remove(JsArray array, object item)
 {
     return(null);
 }
コード例 #40
0
 /// <summary>
 /// Sorts the elements of an Array. ...
 /// </summary>
 public static JsArray sort(JsArray array, JsAction sortFn = null)
 {
     return(null);
 }
コード例 #41
0
 public void Dispose()
 {
     List = null;
 }
コード例 #42
0
 /// <summary>
 /// Perform a set difference A-B by subtracting all items in array B from array A. ...
 /// </summary>
 public static JsArray difference(JsArray arrayA, JsArray arrayB)
 {
     return(null);
 }
コード例 #43
0
 public JsArray <Translation> translateKeysSynchronously(JsString domain, JsArray <JsString> keys)
 {
     return(translator.synchronousTranslate(domain, keys));
 }
コード例 #44
0
 /// <summary>
 /// Removes items from an array. ...
 /// </summary>
 public static JsArray erase(JsArray array, JsNumber index, JsNumber removeCount)
 {
     return(null);
 }
コード例 #45
0
        /**
         * Block for setting the element at index.
         * @this Blockly.Block
         */
        public override void init()
        {
            var MODE = new JsArray <DropdownItemInfo> {
                new DropdownItemInfo(Msg.LISTS_SET_INDEX_SET, "SET"),
                new DropdownItemInfo(Msg.LISTS_SET_INDEX_INSERT, "INSERT")
            };

            this.WHERE_OPTIONS = new JsArray <DropdownItemInfo> {
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_FROM_START, "FROM_START"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_FROM_END, "FROM_END"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_FIRST, "FIRST"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_LAST, "LAST"),
                new DropdownItemInfo(Msg.LISTS_GET_INDEX_RANDOM, "RANDOM")
            };
            this.setHelpUrl(Msg.LISTS_SET_INDEX_HELPURL);
            this.setColour(Lists.HUE);
            this.appendValueInput("LIST")
            .setCheck("Array")
            .appendField(Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
            this.appendDummyInput()
            .appendField(new FieldDropdown(MODE), "MODE")
            .appendField("", "SPACE");
            this.appendDummyInput("AT");
            this.appendValueInput("TO")
            .appendField(Msg.LISTS_SET_INDEX_INPUT_TO);
            this.setInputsInline(true);
            this.setPreviousStatement(true);
            this.setNextStatement(true);
            this.setTooltip(Msg.LISTS_SET_INDEX_TOOLTIP);
            this.updateAt_(true);
            // Assign "this" to a variable for use in the tooltip closure below.
            var thisBlock = this;

            this.setTooltip(new Func <string>(() => {
                var mode    = thisBlock.getFieldValue("MODE");
                var where   = thisBlock.getFieldValue("WHERE");
                var tooltip = "";
                switch (mode + " " + where)
                {
                case "SET FROM_START":
                case "SET FROM_END":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;
                    break;

                case "SET FIRST":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;
                    break;

                case "SET LAST":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;
                    break;

                case "SET RANDOM":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;
                    break;

                case "INSERT FROM_START":
                case "INSERT FROM_END":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;
                    break;

                case "INSERT FIRST":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;
                    break;

                case "INSERT LAST":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;
                    break;

                case "INSERT RANDOM":
                    tooltip = Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM;
                    break;
                }
                if (where == "FROM_START" || where == "FROM_END")
                {
                    tooltip += "  " + Msg.LISTS_INDEX_FROM_START_TOOLTIP
                               .Replace("%1",
                                        thisBlock.workspace.options.oneBasedIndex ? "#1" : "#0");
                }
                return(tooltip);
            }));
        }
コード例 #46
0
 /// <summary>
 /// Calculates the mean of all items in the array. ...
 /// </summary>
 public static JsNumber mean(JsArray array)
 {
     return(null);
 }
コード例 #47
0
 /// <summary>
 /// Fires when this node's childNodes are sorted.
 /// </summary>
 /// <param name="this"><p>This node.</p>
 /// </param>
 /// <param name="childNodes"><p>The childNodes of this node.</p>
 /// </param>
 /// <param name="eOpts"><p>The options object passed to <see cref="Ext.util.Observable.addListener">Ext.util.Observable.addListener</see>.</p>
 /// </param>
 public void sort(NodeInterface @this, JsArray <Ext.data.NodeInterface> childNodes, object eOpts)
 {
 }
コード例 #48
0
 /// <summary>
 /// Merge multiple arrays into one with unique items that exist in all of the arrays. ...
 /// </summary>
 public static JsArray intersect(JsArray array1, JsArray array2, JsArray etc)
 {
     return(null);
 }
コード例 #49
0
 public void SetModel(JsArray value)
 {
     throw new NotImplementedException();
 }
コード例 #50
0
 /// <summary>
 /// Replaces items in an array. ...
 /// </summary>
 public static JsArray replace(JsArray array, JsNumber index, JsNumber removeCount, JsArray insert)
 {
     return(null);
 }
コード例 #51
0
		public void AddItems(qx.ui.core.Widget items, string names, string title, JsArray itemsOptions = null, object headerOptions = null) { throw new NotImplementedException(); }
コード例 #52
0
 /// <summary>
 /// Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
 /// </summary>
 /// <param name="disabledDays"><p>An array of disabled day indexes. See the <see cref="Ext.picker.DateConfig.disabledDays">disabledDays</see> config for details
 /// on supported values.</p>
 /// </param>
 /// <returns>
 /// <span><see cref="Ext.picker.Date">Ext.picker.Date</see></span><div><p>this</p>
 /// </div>
 /// </returns>
 public Ext.picker.Date setDisabledDays(JsArray<Number> disabledDays){return null;}
コード例 #53
0
 /// <summary>
 /// Executes the specified function for each array element until the function returns a falsy value. ...
 /// </summary>
 public static bool every(JsArray array, JsAction fn, object scope)
 {
     return(false);
 }
コード例 #54
0
 /// <summary>
 /// Filter through an array and remove empty item as defined in Ext.isEmpty
 /// See filter ...
 /// </summary>
 public static JsArray clean(JsArray array)
 {
     return(null);
 }
コード例 #55
0
 /// <summary>
 /// Creates a new array with all of the elements of this array for which
 /// the provided filtering function returns true. ...
 /// </summary>
 public static JsArray filter(JsArray array, JsAction fn, object scope)
 {
     return(null);
 }
コード例 #56
0
 public JsImplStringWriter()
 {
     array = new JsArray <string>();
 }
コード例 #57
0
ファイル: TheMProject.cs プロジェクト: hultqvist/SharpKit-SDK
 /// <summary>
 /// This method can be used to select items programmatically. The given parameter can either be a String (single selection) or an Array (multiple selection).
 /// </summary>
 /// <param name="selection">(String or Array): The item/entry (its value) that should be selected.</param>
 public void setSelection(JsArray selection) { }
コード例 #58
0
 public JsImplStringWriter(string s)
 {
     array  = new JsArray <string>(s);
     Length = s == null ? 0 : s.Length;
 }
コード例 #59
0
 /// <summary>
 /// Calculates the sum of all items in the given array. ...
 /// </summary>
 public static JsNumber sum(JsArray array)
 {
     return(null);
 }
コード例 #60
0
 /// <summary>
 /// Get the index of the provided item in the given array, a supplement for the
 /// missing arrayPrototype.indexOf in Interne...
 /// </summary>
 public static JsNumber indexOf(JsArray array, object item)
 {
     return(null);
 }