Exemplo n.º 1
0
 // PUBLIC FUNCTIONS EXPOSED TO JAVASCRIPT as io.nodekit.process.*
 public void nextTick(NKScriptValue callback)
 {
     Task.Factory.StartNew(() =>
     {
         callback.callWithArguments(new object[] { });
     });
 }
Exemplo n.º 2
0
 // PUBLIC FUNCTIONS EXPOSED TO JAVASCRIPT as io.nodekit.process.*
 public void nextTick(NKScriptValue callback)
 {
     Task.Factory.StartNew(() =>
     {
         callback.callWithArguments(new object[] { });
     });
    
 }
Exemplo n.º 3
0
 public void close()
 {
     if (_nsTimer != null)
     {
         _nsTimer.Cancel();
         _nsTimer = null;
     }
     _repeatPeriod = 0;
     _handler      = null;
     this.getNKScriptValue().invokeMethod("dispose", new object[] {  });
 }
       public void showMessageBox(NKE_BrowserWindow browserWindow, Dictionary<string, object> options, NKScriptValue callback)
        {
            string caption = NKOptions.itemOrDefault(options, "title", "");
            string message = NKOptions.itemOrDefault(options, "message", "");
            string [] buttonArray = NKOptions.itemOrDefault(options, "buttons", new string[] { "OK" });
            string detail = NKOptions.itemOrDefault(options, "detail", "");

            MessageBoxIcon icon;
            switch (detail)
            {
                case "info":
                    icon = MessageBoxIcon.Information;
                    break;
                case "warning":
                    icon = MessageBoxIcon.Warning;
                    break;
                case "error":
                    icon = MessageBoxIcon.Error;
                    break;
                default:
                    icon = MessageBoxIcon.None;
                    break;
            }
            
            MessageBoxButtons buttons = buttons = MessageBoxButtons.OK;

            if ((Array.IndexOf(buttonArray, "OK") > -1) && (Array.IndexOf(buttonArray, "Cancel") > -1))
                buttons = MessageBoxButtons.OKCancel;
            else if (Array.IndexOf(buttonArray, "OK") > -1)
                   buttons = MessageBoxButtons.OK;
            else if ((Array.IndexOf(buttonArray, "Abort") > -1) && (Array.IndexOf(buttonArray, "Retry") > -1) && (Array.IndexOf(buttonArray, "Ignore") > -1))
                buttons = MessageBoxButtons.AbortRetryIgnore;
            else if ((Array.IndexOf(buttonArray, "Yes") > -1) && (Array.IndexOf(buttonArray, "No") > -1) && (Array.IndexOf(buttonArray, "Cancel") > -1))
                buttons = MessageBoxButtons.YesNoCancel;
            else if ((Array.IndexOf(buttonArray, "Yes") > -1) && (Array.IndexOf(buttonArray, "No") > -1))
                buttons = MessageBoxButtons.YesNo;
            else if ((Array.IndexOf(buttonArray, "Retry") > -1) && (Array.IndexOf(buttonArray, "Cancel") > -1))
                buttons = MessageBoxButtons.RetryCancel;

            DialogResult result = MessageBox.Show(message, caption, buttons, icon);
            if (callback != null)
                 callback.callWithArguments(new object[] { result.ToString() });
        }
Exemplo n.º 5
0
        public void showMessageBox(NKE_BrowserWindow browserWindow, Dictionary<string, object> options, NKScriptValue callback)
        {
            string title = NKOptions.itemOrDefault(options, "title", "");
            string message = NKOptions.itemOrDefault(options, "message", "");
            string[] buttonArray = NKOptions.itemOrDefault(options, "buttons", new string[] { "OK" });
            string detail = NKOptions.itemOrDefault(options, "detail", "");

            MessageDialog msgbox = new MessageDialog(message, title);

            msgbox.Commands.Clear();
            int count = 0;
            foreach (var item in buttonArray)
            {
                msgbox.Commands.Add(new UICommand { Label = item, Id = count++ });
            }

            var t = msgbox.ShowAsync();
            if (callback != null)
                t.AsTask().ContinueWith((u) => callback.callWithArguments(new object[] { u.Result.Label }));
        }
 public void savePage(string fullstring, string saveType, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public void close()
 {
     if (_nsTimer != null)
     {
         _nsTimer.Stop();
         _nsTimer.Dispose();
         _nsTimer = null;
     }
     _repeatPeriod = 0;
     _handler = null;
     this.getNKScriptValue().invokeMethod("dispose", new object[] {  });
 }
 public void showSaveDialog(NKE_BrowserWindow browserWindow, Dictionary<string, object> options, NKScriptValue callback)
  {
      throw new NotImplementedException();
  }
Exemplo n.º 9
0
 public void unregisterServiceWorker(NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 public void setOnTimeout(NKScriptValue handler)
 {
     _handler = handler;
 }
 internal static void setNKScriptValue(this object obj, NKScriptValue value)
 {
     if (value != null)
         dictionary[obj] = value;
     else
         dictionary.Remove(obj);
 }
Exemplo n.º 12
0
 public void savePage(string fullstring, string saveType, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
 public void printToPDF(Dictionary<string, object> options, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
 public void showSaveDialog(NKE_BrowserWindow browserWindow, Dictionary <string, object> options, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
        public void showMessageBox(NKE_BrowserWindow browserWindow, Dictionary <string, object> options, NKScriptValue callback)
        {
            string title   = NKOptions.itemOrDefault(options, "title", "");
            string message = NKOptions.itemOrDefault(options, "message", "");

            string[] buttonArray = NKOptions.itemOrDefault(options, "buttons", new string[] { "OK" });
            string   detail      = NKOptions.itemOrDefault(options, "detail", "");

            MessageDialog msgbox = new MessageDialog(message, title);

            msgbox.Commands.Clear();
            int count = 0;

            foreach (var item in buttonArray)
            {
                msgbox.Commands.Add(new UICommand {
                    Label = item, Id = count++
                });
            }

            var t = msgbox.ShowAsync();

            if (callback != null)
            {
                t.AsTask().ContinueWith((u) => callback.callWithArguments(new object[] { u.Result.Label }));
            }
        }
 public void beginFrameSubscription(NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 17
0
 public void setOnTimeout(NKScriptValue handler)
 {
     _handler = handler;
 }
 public void capturePage(Dictionary <string, object> rect, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
 public void hookWindowMessage(int message, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
 public void hookWindowMessage(int message, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
 public void unregisterServiceWorker(NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
 public void capturePage(Dictionary<string, object> rect, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 23
0
 public void beginFrameSubscription(NKScriptValue callback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 24
0
        public void showMessageBox(NKE_BrowserWindow browserWindow, Dictionary <string, object> options, NKScriptValue callback)
        {
            string caption = NKOptions.itemOrDefault(options, "title", "");
            string message = NKOptions.itemOrDefault(options, "message", "");

            string [] buttonArray = NKOptions.itemOrDefault(options, "buttons", new string[] { "OK" });
            string    detail      = NKOptions.itemOrDefault(options, "detail", "");

            MessageBoxIcon icon;

            switch (detail)
            {
            case "info":
                icon = MessageBoxIcon.Information;
                break;

            case "warning":
                icon = MessageBoxIcon.Warning;
                break;

            case "error":
                icon = MessageBoxIcon.Error;
                break;

            default:
                icon = MessageBoxIcon.None;
                break;
            }

            MessageBoxButtons buttons = buttons = MessageBoxButtons.OK;

            if ((Array.IndexOf(buttonArray, "OK") > -1) && (Array.IndexOf(buttonArray, "Cancel") > -1))
            {
                buttons = MessageBoxButtons.OKCancel;
            }
            else if (Array.IndexOf(buttonArray, "OK") > -1)
            {
                buttons = MessageBoxButtons.OK;
            }
            else if ((Array.IndexOf(buttonArray, "Abort") > -1) && (Array.IndexOf(buttonArray, "Retry") > -1) && (Array.IndexOf(buttonArray, "Ignore") > -1))
            {
                buttons = MessageBoxButtons.AbortRetryIgnore;
            }
            else if ((Array.IndexOf(buttonArray, "Yes") > -1) && (Array.IndexOf(buttonArray, "No") > -1) && (Array.IndexOf(buttonArray, "Cancel") > -1))
            {
                buttons = MessageBoxButtons.YesNoCancel;
            }
            else if ((Array.IndexOf(buttonArray, "Yes") > -1) && (Array.IndexOf(buttonArray, "No") > -1))
            {
                buttons = MessageBoxButtons.YesNo;
            }
            else if ((Array.IndexOf(buttonArray, "Retry") > -1) && (Array.IndexOf(buttonArray, "Cancel") > -1))
            {
                buttons = MessageBoxButtons.RetryCancel;
            }

            DialogResult result = MessageBox.Show(message, caption, buttons, icon);

            if (callback != null)
            {
                callback.callWithArguments(new object[] { result.ToString() });
            }
        }
Exemplo n.º 25
0
 public void printToPDF(Dictionary <string, object> options, NKScriptValue callback)
 {
     throw new NotImplementedException();
 }