Esempio n. 1
0
        public PoshTimeliner(string url, int port)
        {
            FUrl = url;
            FPoshServer = new PoshServer(port);
            FPoshServer.AutoPublishAllAfterRemoteCall = false;
            FPoshServer.OnSessionCreated += PoshServer_SessionCreated;
            FPoshServer.OnSessionClosed += PoshServer_SessionClosed;
            FPoshServer.OnKeyDown += PoshServer_OnKeyDown;
            FPoshServer.OnKeyUp += PoshServer_OnKeyUp;
            FPoshServer.OnKeyPress += PoshServer_OnKeyPress;
            FPoshServer.OnDump += PoshServer_OnDump;

            Context.Initialize();
            Context.MappingRegistry.RegisterDefaultInstance<ICommandHistory>(Context.History);
            Context.MappingRegistry.RegisterDefaultInstance<PoshServer>(FPoshServer);
            Context.MappingRegistry.RegisterDefaultInstance<RemoteContext>(FPoshServer.RemoteContext);
            Context.MappingRegistry.RegisterDefaultInstance<ISvgEventCaller>(FPoshServer.SvgEventCaller);

            Timeliner = new Timeliner(Context);

            //apparently initializing the timeline with tracks adds something to the contexts but they are not flushed
            //since info goes out via initial dump. so clear them here
            FPoshServer.RemoteContext.ClearAll();

            //register context sending
            Timeliner.TimelineView.History.CommandInserted += HistoryChanged;
            Timeliner.TimelineView.History.Undone += HistoryChanged;
            Timeliner.TimelineView.History.Redone += HistoryChanged;
        }
Esempio n. 2
0
        public PoshTimeliner(string url, int port)
        {
            FUrl        = url;
            FPoshServer = new PoshServer(port);
            FPoshServer.AutoPublishAllAfterRemoteCall = false;
            FPoshServer.OnSessionCreated += PoshServer_SessionCreated;
            FPoshServer.OnSessionClosed  += PoshServer_SessionClosed;
            FPoshServer.OnKeyDown        += PoshServer_OnKeyDown;
            FPoshServer.OnKeyUp          += PoshServer_OnKeyUp;
            FPoshServer.OnKeyPress       += PoshServer_OnKeyPress;
            FPoshServer.OnDump           += PoshServer_OnDump;

            Context.Initialize();
            Context.MappingRegistry.RegisterDefaultInstance <ICommandHistory>(Context.History);
            Context.MappingRegistry.RegisterDefaultInstance <PoshServer>(FPoshServer);
            Context.MappingRegistry.RegisterDefaultInstance <RemoteContext>(FPoshServer.RemoteContext);
            Context.MappingRegistry.RegisterDefaultInstance <ISvgEventCaller>(FPoshServer.SvgEventCaller);

            Timeliner = new Timeliner(Context);

            //apparently initializing the timeline with tracks adds something to the contexts but they are not flushed
            //since info goes out via initial dump. so clear them here
            FPoshServer.RemoteContext.ClearAll();

            //register context sending
            Timeliner.TimelineView.History.CommandInserted += HistoryChanged;
            Timeliner.TimelineView.History.Undone          += HistoryChanged;
            Timeliner.TimelineView.History.Redone          += HistoryChanged;
        }
Esempio n. 3
0
        // Dispose(bool disposing) executes in two distinct scenarios.
        // If disposing equals true, the method has been called directly
        // or indirectly by a user's code. Managed and unmanaged resources
        // can be disposed.
        // If disposing equals false, the method has been called by the
        // runtime from inside the finalizer and you should not reference
        // other objects. Only unmanaged resources can be disposed.
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!FDisposed)
            {
                if (disposing)
                {
                    Timeliner.Dispose();
                    Timeliner = null;

                    FPoshServer.Dispose();
                    FPoshServer = null;
                }
                // Release unmanaged resources. If disposing is false,
                // only the following code is executed.


                // Note that this is not thread safe.
                // Another thread could start disposing the object
                // after the managed resources are disposed,
                // but before the disposed flag is set to true.
                // If thread safety is necessary, it must be
                // implemented by the client.
            }
            FDisposed = true;
        }
Esempio n. 4
0
        public MainForm()
        {
            // The InitializeComponent() call is required for Windows Forms designer support.
            InitializeComponent();

            Log = x => Console.WriteLine(x);

            //register a url and receive a unique websocketport for it
            var url  = WebServer.AddURL("poshdemo");
            var port = WebServer.URLPort[url];

            //create a wampserver/websocket on the given port
            FPoshServer                   = new PoshServer(port);
            FPoshServer.OnDump           += PoshGraphDump;
            FPoshServer.OnSessionCreated += PoshSessionCreated;
            FPoshServer.OnSessionClosed  += PoshSessionClosed;

            //setup keyboard handlers
//			FWAMPServer.OnKeyDown += KeyDownHandler;
//			FWAMPServer.OnKeyUp += KeyUpHandler;
//			FWAMPServer.OnKeyPress += KeyPressHandler;

            //create an svg document
            ViewRoot = new SvgDocument();

            //hand the svg document a custom idmanager that talks to the WampServer
            var manager = new SvgIdManager(ViewRoot, FPoshServer.SvgEventCaller, FPoshServer.RemoteContext);

            ViewRoot.OverwriteIdManager(manager);

            //fill the svg document
            SetupInitialView();

            //open the canvas: the window showing the view is a webbrowser navigating to the given url on localhost
            webBrowser1.Navigate("about:blank");
            webBrowser1.Navigate(new Uri("http://localhost:4444/" + url));

            //dispose web- and wampserver
            this.Disposed += (s, e) =>
            {
                WebServer.Stop();
                FPoshServer.Dispose();
            };
        }
Esempio n. 5
0
        // Dispose(bool disposing) executes in two distinct scenarios.
        // If disposing equals true, the method has been called directly
        // or indirectly by a user's code. Managed and unmanaged resources
        // can be disposed.
        // If disposing equals false, the method has been called by the
        // runtime from inside the finalizer and you should not reference
        // other objects. Only unmanaged resources can be disposed.
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if(!FDisposed)
            {
                if(disposing)
                {
                    Timeliner.Dispose();
                    Timeliner = null;

                    FPoshServer.Dispose();
                    FPoshServer = null;
                }
                // Release unmanaged resources. If disposing is false,
                // only the following code is executed.

                // Note that this is not thread safe.
                // Another thread could start disposing the object
                // after the managed resources are disposed,
                // but before the disposed flag is set to true.
                // If thread safety is necessary, it must be
                // implemented by the client.
            }
            FDisposed = true;
        }