Example #1
0
        private void Restart()
        {
            if (m_toRumps != null)
            {
                m_toRumps.Dispose();
            }

            var startinfo = new System.Diagnostics.ProcessStartInfo(RUMPS_PYTHON, string.Format("\"{0}\"", SCRIPT_PATH));

            startinfo.CreateNoWindow         = true;
            startinfo.UseShellExecute        = false;
            startinfo.RedirectStandardInput  = true;
            startinfo.RedirectStandardOutput = true;
            startinfo.RedirectStandardError  = true;

            m_rumpsProcess = System.Diagnostics.Process.Start(startinfo);
            var ch = ChannelManager.CreateChannel <string>();

            m_toRumps = ch.AsWriteOnly();

            WriteChannel(m_rumpsProcess.StandardInput, ch.AsReadOnly());
            #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ReadChannel(m_rumpsProcess.StandardOutput);
            ReadChannel(m_rumpsProcess.StandardError);
            #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new { Action = "background" }));
            //m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new {Action = "setappicon", Image = GetIcon(m_lastIcon)}));

            if (m_menus != null)
            {
                ResetMenus();
                m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new { Action = "seticon", Image = GetIcon(m_lastIcon) }));
            }
        }
Example #2
0
        private void Restart()
        {
            if (m_toRumps != null)
            {
                m_toRumps.Dispose();
            }

            var startinfo = new System.Diagnostics.ProcessStartInfo(RUMPS_PYTHON, string.Format("\"{0}\"", SCRIPT_PATH));

            startinfo.CreateNoWindow         = true;
            startinfo.UseShellExecute        = false;
            startinfo.RedirectStandardInput  = true;
            startinfo.RedirectStandardOutput = true;
            startinfo.RedirectStandardError  = true;

            m_rumpsProcess = System.Diagnostics.Process.Start(startinfo);
            var ch = ChannelManager.CreateChannel <string>();

            m_toRumps = ch.AsWriteOnly();

            WriteChannel(m_rumpsProcess.StandardInput, ch.AsReadOnly());
            var standardOutputTask = ReadChannel(m_rumpsProcess.StandardOutput);
            var standardErrorTask  = ReadChannel(m_rumpsProcess.StandardError);

            m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new { Action = "background" }));
            //m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new {Action = "setappicon", Image = GetIcon(m_lastIcon)}));

            if (m_menus != null)
            {
                ResetMenus();
                m_toRumps.WriteNoWait(JsonConvert.SerializeObject(new { Action = "seticon", Image = GetIcon(m_lastIcon) }));
            }
        }
Example #3
0
 /// <summary>
 /// Releases all resource used by the <see cref="CoCoL.Network.LatencyHidingWriter&lt;T&gt;"/> object.
 /// </summary>
 /// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="CoCoL.Network.LatencyHidingWriter&lt;T&gt;"/>. The
 /// <see cref="Dispose"/> method leaves the <see cref="CoCoL.Network.LatencyHidingWriter&lt;T&gt;"/> in an unusable state.
 /// After calling <see cref="Dispose"/>, you must release all references to the
 /// <see cref="CoCoL.Network.LatencyHidingWriter&lt;T&gt;"/> so the garbage collector can reclaim the memory that the
 /// <see cref="CoCoL.Network.LatencyHidingWriter&lt;T&gt;"/> was occupying.</remarks>
 public void Dispose()
 {
     m_parent.Dispose();
 }