DEV Community

artydev
artydev

Posted on

Photino.Net.API

Photino.Net.API, a very nice wrapper around Photino

using System;
using PhotinoNET;

namespace Photino.NET.API.Tests {
    internal class Program {
        [STAThread]
        static void Main(String[] args) {
            var appExeDir = AppContext.BaseDirectory;

            var window = new PhotinoAPIWindow()
                .SetLogVerbosity(true)
                .RegisterAPI(new APIs.Counter())
                .SetTitle("{title}")
                .SetUseOsDefaultSize(false)
                .SetWidth(600).SetHeight(400).Center()
                .SetDevToolsEnabled(true)
                .SetContextMenuEnabled(true)
                .SetRemoveTempFile(false)
                .LoadFile("{file}");

            window.WaitForClose();
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Your API's

    public class Counter {
        private Int32 count = 0;


        public JsonResponse CountUp() {
            this.count += 1;
            return new JsonResponse{ { "count", this.count } };
        }

        public JsonResponse CountDown() {
            if (this.count > 0) {
                this.count -= 1;
            }

            return new JsonResponse{ { "count", this.count } };
        }

    }
Enter fullscreen mode Exit fullscreen mode

Usage client side

function countUp() {
    photino.Counter.CountUp();
}

function countDown() {
    photino.Counter.CountDown();
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)