// 创建托盘图标、添加选项
 void AddSystemTray()
 {
     _icon = Rainity.CreateSystemTrayIcon();
     _icon.AddItem("切换置顶显示", ToggleTopMost);
     _icon.AddItem("切换开机自启", ToggleRunOnStartup);
     _icon.AddSeparator();
     // _icon.AddItem("检查更新", CheckUpdate);// 必然闪退
     _icon.AddItem("清除设置并退出", Clean);
     _icon.AddSeparator();
     _icon.AddItem("退出", Exit);
 }
Пример #2
0
 void AddRoleItem(SystemTray tray)
 {
     _roleItem = new System.Windows.Forms.ToolStripItem[_config.roles.Length];
     foreach (var item in DataModel.Instance.Data.roles)
     {
         var i = item.index;
         _roleItem[i] = tray.AddItem(((Roles)i).ToString(), () =>
         {
             ToggleRole(i);
         });
         _roleItem[i].Image = item.enable ? _enableImage : null;
     }
 }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        //Set file icon texture demonstration
        if (File.Exists(Environment.SystemDirectory + "\\notepad.exe"))
        {
            iconRenderer.material.mainTexture = Rainity.GetFileIcon(Environment.SystemDirectory + "\\notepad.exe");
        }
        //Set wallpaper image texture demonstration
        wallpaperRenderer.material.mainTexture = Rainity.GetWallpaperImage();
        //Set user avatar texture demonstration
        avatarRenderer.material.mainTexture = Rainity.GetUserAvatar();

        //Create system tray icon (standalone only, editor causes random crashes)
        tray = Rainity.CreateSystemTrayIcon();
        if (tray != null)
        {
            tray.AddItem("Context menu items with attached functions!", ExitApplication);
            tray.AddSeparator();
            tray.AddItem("Exit", ExitApplication);

            tray.SetTitle("Rainity Demo Application");
        }

        //Get information about the weather and assign text
        WeatherObject weather = Rainity.GetWeatherInformation();

        weather_cityState.text   = weather.query.results.channel.location.city + ", " + weather.query.results.channel.location.region;
        weather_temperature.text = weather.query.results.channel.item.condition.temp + "°" + weather.query.results.channel.units.temperature;
        weather_condition.text   = weather.query.results.channel.item.condition.text;
        weather_windSpeed.text   = "Wind speed: " + weather.query.results.channel.wind.speed + weather.query.results.channel.units.speed;

        RainityFile[] files = Rainity.GetFiles("C:\\Users\\Christian\\Desktop");
        foreach (RainityFile file in files)
        {
            Debug.Log(file.fileName);
        }
    }
Пример #4
0
    // 创建托盘图标、添加选项
    void AddSystemTray()
    {
        _icon       = new SystemTray(_systemTrayIcon);
        _topmost    = _icon.AddItem("置顶显示", ToggleTopMost);
        _runOnStart = _icon.AddItem("开机自启", ToggleRunOnStartup);
        _icon.AddItem("重置位置", ResetPos);
        _icon.AddSeparator();
        _icon.AddItem("查看文档", OpenDoc);
        _icon.AddItem("检查更新", CheckUpdate);
        _icon.AddSeparator();
        _icon.AddItem("退出", Exit);
        _icon.AddDoubleClickEvent(ToggleTopMost);
        _icon.AddSingleClickEvent(ShowRole);

        _topmost.Image    = DataModel.Instance.Data.isTopMost ? _enableImage : null;
        _runOnStart.Image = DataModel.Instance.Data.isRunOnStartup ? _enableImage : null;
    }