Пример #1
0
 private static void onUpAndRunning()
 {
     {
         subscribeToMiscEvents();
     }
     OutputChannel logchan       = default;
     bool          toggleonclick = default;
     {
         vsc.Window.CreateOutputChannel(appName)((OutputChannel it) => {
             logchan = it;
             setOutChan(logchan);
             logLn(strFmt("Hi, I'm `{0}`, this is my own custom `OutputChannel` where I leisurely log all your interactions with me. When I'm ended, it too will disappear.", appName));
             logLn("");
             logLn("NOTE that for logging error messages, you won't need to manually create a custom `OutputChannel` at all: just have your prog print to its `stderr` as (presumably) usual, and `vscode-appz` will then create a dedicated `OutputChannel` for (both that initial and all subsequent) `stderr` prints from your prog while it's up and running.");
             logLn("");
             if (toggleonclick)
             {
                 logLn("Note also that every click on my status-bar item will toggle my visibility.");
                 logLn("");
             }
             logchan.Show(true);
         });
     }
     {
         StatusBarItem statusitem = default;
         int           clickcount = default;
         clickcount = 0;
         Func <any[], any> mycmd = default;
         mycmd = (any[] _unused) => {
             clickcount = 1 + clickcount;
             statusitem.Cfg.ReFetch()(() => {
                 statusitem.Cfg.Text = logLn(strFmt("You clicked me {0} time(s).", clickcount));
                 if ("editorLightBulb.foreground" == statusitem.Cfg.Color)
                 {
                     statusitem.Cfg.Color = "terminal.ansiGreen";
                     if (toggleonclick && (null != logchan))
                     {
                         logchan.Hide();
                     }
                 }
                 else
                 {
                     statusitem.Cfg.Color = "editorLightBulb.foreground";
                     if (toggleonclick && (null != logchan))
                     {
                         logchan.Show(true);
                     }
                 }
                 statusitem.Cfg.ApplyChanges()(demosMenu);
             });
             return(null);
         };
         vsc.Commands.RegisterCommand(cmdName, mycmd);
         vsc.Window.CreateStatusBarItem(0, null)((StatusBarItem it) => {
             statusitem             = it;
             statusitem.Cfg.Tooltip = strFmt("Hi from {0}!", appName);
             statusitem.Cfg.Text    = "You clicked me 0 time(s).";
             statusitem.Cfg.Color   = "#42BEEF";
             statusitem.Cfg.Command = cmdName;
             statusitem.Cfg.ApplyChanges();
             statusitem.Show();
         });
     }
 }