image_service.he

来自「维信SDK文档。源码要求为至少5个C或Java源码」· HE 代码 · 共 51 行

HE
51
字号
class
{
  void startWidget()
  {
    setMinimizedView(createMinimizedView("viewMini", getStyle("default")));
  }


  Shell openWidget()
  {
    fetch();
    
    return null;
  }

  
  void fetch()
  {
    int x, int y = getScreenSize();
    
    Value arg = [
      "url" => "http://dev.widsets.com/images/widsets_dev_logo.gif",
      "boundx" => x - 40,
      "boundy" => y - 40,
      "format" => "png8"
    ];

    call(null, "imageService", "geturl", arg, ok, nok);
  }


  void ok(Object state, Value ret)
  {
    Image img = getImage(ByteArray(ret));
    
    //bubble is the easiest way to show images, normally
    //one would instantiate new Picture component and
    //place the Image inside it and then place the Picture
    //component in a flow
    
    setBubble(img, "Success");
  }


  void nok(Object state, String error)
  {
    setBubble(null, "Error getting image: "+error);
  }

} //class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?