当前位置: 首页>>代码示例>>C#>>正文


C# ScriptObject类代码示例

本文整理汇总了C#中ScriptObject的典型用法代码示例。如果您正苦于以下问题:C# ScriptObject类的具体用法?C# ScriptObject怎么用?C# ScriptObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScriptObject类属于命名空间,在下文中一共展示了ScriptObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GMapAPI

        public GMapAPI()
        {
            timer.Interval = TimeSpan.FromMilliseconds(100);
            timer.Tick += new EventHandler(timer_Tick);

            gload = (ScriptObject)HtmlPage.Window.GetProperty("GLoad");
            if (gload == null)
            {
                HtmlElement scriptElement = HtmlPage.Document.CreateElement("script");
                scriptElement.SetAttribute("type", "text/javascript");

                string src = "http://maps.google.com/maps?file=api&v=2";
                scriptElement.SetAttribute("src", src);
                HtmlPage.Document.Body.AppendChild(scriptElement);
                gload = (ScriptObject)HtmlPage.Window.GetProperty("GLoad");
                if (gload == null)
                {
                    timer.Start();
                }
                else
                {
                    SetReady();
                }
            }
        }
开发者ID:Titaye,项目名称:SLExtensions,代码行数:25,代码来源:GMapAPI.cs

示例2: ScriptObjectEventInfo

		public ScriptObjectEventInfo (string name, ScriptObject callback, EventInfo ei)
		{
			Name = name;
			Callback = callback;
			EventInfo = ei;
			NativeMethods.html_object_retain (PluginHost.Handle, Callback.Handle);
		}
开发者ID:snorp,项目名称:moon,代码行数:7,代码来源:ScriptObjectEventInfo.cs

示例3: Execute

 public override bool Execute(ScriptObject scriptObject)
 {
     try
     {
         int cameranum = 0;
         if (int.TryParse(scriptObject.ParseString(LoadedParams["cameranum"]), out cameranum))
         {
             if (cameranum > -1 && cameranum < ServiceProvider.DeviceManager.ConnectedDevices.Count)
             {
                 ServiceProvider.DeviceManager.SelectedCameraDevice =
                     ServiceProvider.DeviceManager.ConnectedDevices[cameranum];
                 scriptObject.CameraDevice = ServiceProvider.DeviceManager.ConnectedDevices[cameranum];
             }
             else
             {
                 ServiceProvider.ScriptManager.OutPut("Camera with number " + cameranum + "not exist");
             }
         }
         else
         {
             ServiceProvider.ScriptManager.OutPut("Wrong camera number");
         }
     }
     catch (Exception exception)
     {
         ServiceProvider.ScriptManager.OutPut("Exception on select camera " + exception.Message);
     }
     return true;
 }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:29,代码来源:SelectCamera.cs

示例4: LoadScript

    // must be called on UI thread
    public static void LoadScript()
    {
      //0 indicates that the script was not injected.
      if (0 != Interlocked.Exchange(ref _scriptInjected, 1))
        return;

      //JavaScript Debug - v0.4 - 6/22/2010
      //http://benalman.com/projects/javascript-debug-console-log/      
      //Copyright (c) 2010 "Cowboy" Ben Alman
      const string script = @"window.debug=(function(){var i=this,b=Array.prototype.slice,d=i.console,h={},f,g,m=9,c=[""error"",""warn"",""info"",""debug"",""log""],l=""assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace"".split("" ""),j=l.length,a=[];while(--j>=0){(function(n){h[n]=function(){m!==0&&d&&d[n]&&d[n].apply(d,arguments)}})(l[j])}j=c.length;while(--j>=0){(function(n,o){h[o]=function(){var q=b.call(arguments),p=[o].concat(q);a.push(p);e(p);if(!d||!k(n)){return}d.firebug?d[o].apply(i,q):d[o]?d[o](q):d.log(q)}})(j,c[j])}function e(n){if(f&&(g||!d||!d.log)){f.apply(i,n)}}h.setLevel=function(n){m=typeof n===""number""?n:9};function k(n){return m>0?m>n:c.length+m<=n}h.setCallback=function(){var o=b.call(arguments),n=a.length,p=n;f=o.shift()||null;g=typeof o[0]===""boolean""?o.shift():false;p-=typeof o[0]===""number""?o.shift():n;while(p<n){e(a[p++])}};return h})();";
      
      try
      {
        HtmlWindow window = HtmlPage.Window;
        window.Eval(script);

        // get handle to methods
        _debugError = window.Eval("debug.error") as ScriptObject;
        _debugWarn = window.Eval("debug.warn") as ScriptObject;
        _debugInfo = window.Eval("debug.info") as ScriptObject;
        _debugLog = window.Eval("debug.log") as ScriptObject;
      }
      catch (Exception ex)
      {
        Debug.WriteLine("Error loading debug.log script: " + ex);
      }
    }
开发者ID:modulexcite,项目名称:LoreSoft.Shared,代码行数:28,代码来源:BrowserConsoleTarget.cs

示例5: HandleNavigate

 public void HandleNavigate(ScriptObject state)
 {
     if (Navigate != null)
     {
         Navigate(this, new StateEventArgs() { State = state });
     }
 }
开发者ID:Titaye,项目名称:SLExtensions,代码行数:7,代码来源:App.xaml.cs

示例6: InitializeConsole

        /// <summary>
        /// Initializes the console for silverlight applications.
        /// </summary>
        /// <returns><c>true</c> if the console is available; otherwise <c>false</c>.</returns>
        private bool InitializeConsole()
        {
            try
            {
                if (_console == null)
                {
                    if (!_dispatcher.CheckAccess())
                    {
                        return false;
                    }
                    
                    var window = HtmlPage.Window;
                    var isConsoleAvailable = (bool)window.Eval("typeof(console) != 'undefined' && typeof(console.log) != 'undefined'");
                    if (isConsoleAvailable)
                    {
                        var createLogFunction = (bool)window.Eval("typeof(catellog) === 'undefined'");
                        if (createLogFunction)
                        {
                            // Load the logging function into global scope:
                            const string logFunction = @"function catellog(msg) { console.log(msg); }";
                            string code = string.Format(@"if(window.execScript) {{ window.execScript('{0}'); }} else {{ eval.call(null, '{0}'); }}", logFunction);
                            window.Eval(code);
                        }

                        _console = window.Eval("catellog") as ScriptObject;
                    }                        
                }
            }
            catch (Exception)
            {
            }

            return (_console != null);
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:38,代码来源:DebugLogListener.cs

示例7: Call

 public object Call(ScriptObject[] args)
 {
     for (int i = 0; i < args.Length; ++i) {
         output += args[i].ToString() + "\n";
     }
     return null;
 }
开发者ID:21423236,项目名称:Scorpio-CSharp,代码行数:7,代码来源:NewBehaviourScript.cs

示例8: Execute

 public override bool Execute(ScriptObject scriptObject)
 {
     ServiceProvider.ScriptManager.OutPut("Bulb capture started");
     Executing = true;
     if (scriptObject.CameraDevice != null)
     {
         if (scriptObject.CameraDevice.IsoNumber != null)
             scriptObject.CameraDevice.IsoNumber.SetValue(Iso);
         Thread.Sleep(200);
         if (scriptObject.CameraDevice.FNumber != null)
             scriptObject.CameraDevice.FNumber.SetValue(Aperture);
         Thread.Sleep(200);
     }
     scriptObject.StartCapture();
     Thread.Sleep(200);
     for (int i = 0; i < CaptureTime; i++)
     {
         if (ServiceProvider.ScriptManager.ShouldStop)
             break;
         Thread.Sleep(1000);
         ServiceProvider.ScriptManager.OutPut(string.Format("Bulb capture in progress .... {0}/{1}", i + 1,
                                                            CaptureTime));
     }
     scriptObject.StopCapture();
     Thread.Sleep(200);
     Executing = false;
     IsExecuted = true;
     ServiceProvider.ScriptManager.OutPut("Bulb capture done");
     return true;
 }
开发者ID:kwagalajosam,项目名称:digiCamControl,代码行数:30,代码来源:BulbCapture.cs

示例9: Execute

        public override bool Execute(ScriptObject scriptObject)
        {
            int time = 0;
            int.TryParse(scriptObject.ParseString(LoadedParams["time"]), out time);
            Executing = true;
            DateTime currTime = DateTime.Now;
            if (LoadedParams["for"] == "camera" && ServiceProvider.DeviceManager.SelectedCameraDevice != null)
            {
                ServiceProvider.ScriptManager.OutPut(string.Format("Waiting .... for camera"));
                while (ServiceProvider.DeviceManager.SelectedCameraDevice.IsBusy)
                {
                    if (ServiceProvider.ScriptManager.ShouldStop)
                        break;
                    Thread.Sleep(100);
                }
            }
            double dif = time - (DateTime.Now - currTime).TotalSeconds;
            if (dif > 0)
            {
                ServiceProvider.ScriptManager.OutPut(string.Format("Waiting .... {0}s", dif));
                while ((DateTime.Now - currTime).TotalSeconds < time)
                {
                    if (ServiceProvider.ScriptManager.ShouldStop)
                        break;
                    Thread.Sleep(100);
                }
            }

            Executing = false;
            IsExecuted = true;
            return true;
        }
开发者ID:avencherus,项目名称:digiCamControl,代码行数:32,代码来源:WaitCommand.cs

示例10: readAsArrayBuffer

        public void readAsArrayBuffer(ScriptObject scriptBlob)
        {
            App.Current.RootVisual.Dispatcher.BeginInvoke((Action<ScriptObject>)delegate(ScriptObject blob)
            {
                this.readAsArrayBufferSync(blob);

            }, new object[]{scriptBlob});
        }
开发者ID:synchrone,项目名称:NFileAPI,代码行数:8,代码来源:FileReader.cs

示例11: NavigateTo

 public void NavigateTo(string controlName, ScriptObject parameterList)
 {
     var paramList = parameterList.ConvertTo<List<object>>();
     var launcher = pageLaunchers[controlName];
     LayoutRoot.Children.Clear();
     var form = launcher(paramList);
     LayoutRoot.Children.Add(form);
 }
开发者ID:rbanks54,项目名称:RichardsSamples,代码行数:8,代码来源:NavigationControl.xaml.cs

示例12: ScriptObjectEventInfo

		// extract common [SecurityCritical] parts of the public .ctors
		private ScriptObjectEventInfo (ScriptObject callback)
		{
			if (callback == null)
				throw new ArgumentNullException ("callback");

			Callback = callback;
			NativeMethods.html_object_retain (PluginHost.Handle, Callback.Handle);
		}
开发者ID:dfr0,项目名称:moon,代码行数:9,代码来源:ScriptObjectEventInfo.cs

示例13: Register

        public static void Register(ScriptObject builtins)
        {
            if (builtins == null) throw new ArgumentNullException(nameof(builtins));
            var mathObject = ScriptObject.From(typeof(MathFunctions));
            mathObject.SetValue("round", new DelegateCustomFunction(Round), true);

            builtins.SetValue("math", mathObject, true);
        }
开发者ID:lunet-io,项目名称:scriban,代码行数:8,代码来源:MathFunctions.cs

示例14: isf_get

        /**
         * Conducts an Isolated Storage data retrieval operation on
         * files identified by or in Objects in a given collection.

         * @param dataArray         a ScriptObject consisting of ScriptObjects that each either identify or contain
         *                          identifying and operation related data pertaining to a data item to be retrieved
         * @param optionsDic        a ScriptObject containing auxiliary data pertinent to the to-be-conducted operation
         * @param operationID       a String uniquely identifying this storage operation in the
         *                          client-side scripting environment in which it was created
         */
        public void isf_get(ScriptObject dataArraySO, ScriptObject optionsSO, String operationID)
        {
            //Will contain key-value pairs each consisting of the name of a file in Isolated Storage
            //denoted or represented by an element in dataArray, and the contents of that file
            Dictionary<String, Object> keyValuePairsDic = new Dictionary<String, Object>();

            int processedItemCount = 0;

            /**
             * Concludes the over-arching retrieval operation, passing to a Javascript function capable of handling
             * such an event the number of files successfully read along with the data resulting from the operation.

             *  @param e        the Exception responsible for concluding the over-arching get operation
             */
            Action<Exception> completeGet = delegate(Exception e)
            {
                Object[] argArray = (e == null ? new Object[] { processedItemCount, keyValuePairsDic }
                                               : new Object[] { processedItemCount, keyValuePairsDic, e });
                complete(operationID, argArray);
            };

            /**
             * Performs a read operation on the file identified by the currently processing ScriptObject
             * in {@code dataArraySO} located in the directory specified by {@code optionsSO}.

             * @param store             an IsolatedStorageFile manifestation of the facility containing
             *                          the file identified by {@code directoryPath} and {@code dataObject}
             * @param directoryPath     a String of the path to the Directory containing the file to be read
             * @param dataObject        an Object either identifying, or containing identifying and
             *                          operation-related data pertaining to a data item to be processed
             */
            Action<IsolatedStorageFile, String, Object> get = delegate(IsolatedStorageFile store, String directoryPath, Object dataObject)
            {
                String fileName;
                String dataFormat;
                String dataEncoding;

                if (dataObject is ScriptObject)
                {
                    ScriptObject dataSO = (ScriptObject)dataObject;
                    fileName = dataSO.GetProperty("key").ToString();
                    dataFormat = (dataSO.GetProperty("dataFormat") != null ? (String)dataSO.GetProperty("dataFormat") : (String)optionsSO.GetProperty("dataFormat"));
                    dataEncoding = (dataSO.GetProperty("dataEncoding") != null ? (String)dataSO.GetProperty("dataEncoding") : (String)optionsSO.GetProperty("dataEncoding"));
                }
                else
                {
                    fileName = dataObject.ToString();
                    dataFormat = (String)optionsSO.GetProperty("dataFormat");
                    dataEncoding = (String)optionsSO.GetProperty("dataEncoding");
                }

                keyValuePairsDic[fileName] = readFile(store, directoryPath + fileName, dataFormat, dataEncoding);
                processedItemCount++;
            };

            isf_getOrRemove(dataArraySO, optionsSO, get, completeGet);
        }
开发者ID:klawson88,项目名称:Baked-Goods,代码行数:67,代码来源:BakedGoods.cs

示例15: Execute

 public override bool Execute(ScriptObject scriptObject)
 {
     foreach (ICameraDevice cameraDevice in ServiceProvider.DeviceManager.ConnectedDevices)
     {
         ICameraDevice device = cameraDevice;
         new Thread(() => Capture(device)).Start();
     }
     return true;
 }
开发者ID:brunoklein99,项目名称:nikon-camera-control,代码行数:9,代码来源:CaptureAll.cs


注:本文中的ScriptObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。