示例#1
0
 void ConversationContextDataReceived(object sender, ContextEventArgs e)
 {
     if (e.ContextDataType.Equals(WireHelpers.Response, StringComparison.OrdinalIgnoreCase))
     {
         ProcessResponse(WireHelpers.ParseResponse(e.ContextData));
     }
 }
示例#2
0
        //--------------------------------------------------------------------------
        // Private Methods
        //--------------------------------------------------------------------------

        /// <summary>
        /// Implementation that runs the actual web server.
        /// </summary>
        /// <remarks>
        /// This code handles dispatching the incomming requests to worker threads
        /// and will run until in a loop until the server is stopped.
        /// </remarks>
        private void Run()
        {
            HttpListenerContext context = null;

            while (!_stop)
            {
                try
                {
                    // waits indefinately for next HttpRequest
                    context = _listener.GetContext();
                    ContextEventArgs args = new ContextEventArgs(context);
                    if ((OnRequest != null) && IsKnown(context.Request.Url))
                    {
                        OnRequest(this, args);
                    }
                    if (!args.Handled)
                    {
                        ThreadPool.QueueUserWorkItem(
                            new WaitCallback(DefaultRequestWorker), args);
                    }
                }
                catch (HttpListenerException hle)
                {
                    TraceMessage(
                        context == null ? Guid.Empty : context.Request.RequestTraceIdentifier,
                        hle.Message);
                }
            }
        }
示例#3
0
        private void Context_ChangesAccepted(object sender, ContextEventArgs e)
        {
            bool logOff = false;

            if (_Context.IsSetting("user", "logon", e.ContextCoupon))
            {
                ContextItem item = new ContextItem("User.Id.logon." + _Suffix);
                string      temp = _Context.GetItemValue(item, false, e.ContextCoupon);

                //
                // Check to see if an application has logged off the user
                //
                if (string.IsNullOrEmpty(temp))
                {
                    logOff = true;
                }
            }
            else
            {
                logOff = true;
            }

            if (logOff)
            {
                Invoke(new MethodInvoker(LogOff));
            }
        }
示例#4
0
 protected virtual void OnContextReleased(ContextEventArgs e)
 {
     if (ContextReleased != null)
     {
         ContextReleased(this, e);
     }
 }
示例#5
0
 private void xna2dDrawingDemo3VC_ContextChanged(object sender, ContextEventArgs e)
 {
     if (drawingContext != null)
     {
         Canvas.LoadContent();
     }
 }
示例#6
0
 private static void LogPostHandler(ContextEventArgs e)
 {
     NameValueCollection postValues = MiniUtility.GetFormValues(e.Context.Request);
     string model = postValues["model"] == null ? postValues["model"] : string.Empty;
     string dateStart = postValues["dateStart"] == null ? postValues["dateStart"] : string.Empty;
     string dateEnd = postValues["dateEnd"] == null ? postValues["dateEnd"] : string.Empty;
 }
示例#7
0
 private void RezerwacjeViewInfo_InitContext(object sender, ContextEventArgs args)
 {
     if (!args.Context.Contains(typeof(RezerwacjeParams)))
     {
         args.Context.Set(new RezerwacjeParams(args.Context)); // dodanie parametrów do kontekstu jeśli nie istnieją
     }
 }
        void options_CustomizeSheetFooter(ContextEventArgs e)
        {
            // Add an empty row to the document's footer.
            e.ExportContext.AddRow();

            // Create a new row.
            var firstRow = new CellObject();

            // Specify row values.
            firstRow.Value = @"The report is generated from the NorthWind database.";
            // Specify the cell content alignment and font settings.
            var rowFormatting = CreateXlFormattingObject(true, 18);

            rowFormatting.Alignment.HorizontalAlignment = XlHorizontalAlignment.Left;
            firstRow.Formatting = rowFormatting;
            // Add the created row to the output document.
            e.ExportContext.AddRow(new[] { firstRow });

            // Create one more row.
            var secondRow = new CellObject();

            // Specify the row value.
            secondRow.Value = @"The addresses and phone numbers are fictitious.";
            // Change the row's font settings.
            rowFormatting.Font.Size   = 14;
            rowFormatting.Font.Bold   = false;
            rowFormatting.Font.Italic = true;
            secondRow.Formatting      = rowFormatting;
            // Add this row to the output document.
            e.ExportContext.AddRow(new[] { secondRow });
        }
 void sourceVoice_BufferEnd(object sender, ContextEventArgs e)
 {
     if (BufferEnd != null)
     {
         BufferEnd(sender, e);
     }
 }
        static void AddAddressLocationCityRow(ContextEventArgs e, XlFormattingObject formatFirstCell,
                                              XlFormattingObject formatSecondCell)
        {
            var AddressLocationCityCell = CreateCell("Los Angeles CA 90731 USA", formatSecondCell);

            e.ExportContext.AddRow(new[] { null, null, AddressLocationCityCell });
        }
示例#11
0
 private static void LogPostHandler(ContextEventArgs e)
 {
     NameValueCollection postValues = MiniUtility.GetFormValues(e.Context.Request);
     string model     = postValues["model"] == null ? postValues["model"] : string.Empty;
     string dateStart = postValues["dateStart"] == null ? postValues["dateStart"] : string.Empty;
     string dateEnd   = postValues["dateEnd"] == null ? postValues["dateEnd"] : string.Empty;
 }
        static void AddFaxRow(ContextEventArgs e, XlFormattingObject formatFirstCell,
                              XlFormattingObject formatSecondCell)
        {
            var faxCellName     = CreateCell("Fax :", formatFirstCell);
            var faxCellLocation = CreateCell("+ 1 (213) 555-1824", formatSecondCell);

            e.ExportContext.AddRow(new[] { faxCellName, null, faxCellLocation });
        }
        static void AddAddressRow(ContextEventArgs e, XlFormattingObject formatFirstCell,
                                  XlFormattingObject formatSecondCell)
        {
            var AddressCellName      = CreateCell("Address: ", formatFirstCell);
            var AddresssCellLocation = CreateCell("807 West Paseo Del Mar", formatSecondCell);

            e.ExportContext.AddRow(new[] { AddressCellName, null, AddresssCellLocation });
        }
        static void AddPhoneRow(ContextEventArgs e, XlFormattingObject formatFirstCell,
                                XlFormattingObject formatSecondCell)
        {
            var phoneCellName     = CreateCell("Phone :", formatFirstCell);
            var phoneCellLocation = CreateCell("+ 1 (213) 555-2828", formatSecondCell);

            e.ExportContext.AddRow(new[] { phoneCellName, null, phoneCellLocation });
        }
示例#15
0
        private void Program_Update(object?sender, ContextEventArgs e)
        {
            var logger = e.Context.LogFile?.GetConsoleLogger();

            logger?.Info("This tool fixes the source code encoding of ExapisSOP.");
            Console.WriteLine();
            EncFixerCore.Fix(logger);
            throw new TerminationException();
        }
示例#16
0
        private void Program_Startup(object?sender, ContextEventArgs e)
        {
#if NETCOREAPP3_1
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#endif
            Console.WriteLine(VersionInfo.Caption);
            Console.WriteLine(VersionInfo.Copyright);
            ConsoleUtil.WriteHorizontalRule();
        }
示例#17
0
        void mVoice_BufferEnd(object sender, ContextEventArgs e)
        {
            if (IsPlaying == false)
            {
                return;
            }

            ReadAndSubmitNextData();
        }
        static void AddEmailRow(ContextEventArgs e, XlFormattingObject formatFirstCell,
                                XlFormattingObject formatSecondCell)
        {
            var emailCellName     = CreateCell("Email :", formatFirstCell);
            var emailCellLocation = CreateCell("*****@*****.**", formatSecondCell);

            emailCellLocation.Hyperlink = "*****@*****.**";
            e.ExportContext.AddRow(new[] { emailCellName, null, emailCellLocation });
        }
示例#19
0
        private void Program_Update(object?sender, ContextEventArgs e)
        {
            var logger = e.Context.LogFile?.GetConsoleLogger();

            logger?.Info("This tool fixes the NuGet package dependency of ExapisSOP.");
            Console.WriteLine();
            PDFixerCore.Fix(logger, e.Context);
            throw new TerminationException();
        }
示例#20
0
        void Contexts_ContextReleased(object sender, ContextEventArgs e)
        {
            IContext sequenceContext = e.Context as IContext;

            if (sequenceContext != null)
            {
                sequenceContext.ContextStarted -= sequenceContext_ContextStarted;
                sequenceContext.ContextEnded   -= sequenceContext_ContextEnded;
            }
        }
示例#21
0
        void RezerwacjeViewInfo_InitContext(object sender, ContextEventArgs args)
        {
            if (args?.Context == null)
            {
                return;
            }

            ClearData(args.Context, new[] { typeof(WParams) });
            args.Context.TryAdd(() => new WParams(args.Context));
        }
示例#22
0
 public override void OnContextBuilt(object source, ContextEventArgs e)
 {
     Assert.AreEqual("Mediflex(DEV3 LabTest)", e.Context.StudyOID);
     Assert.AreEqual(812, e.Context.MetadataVersion);
     Assert.AreEqual("SubjectCreated", e.Context.SubCategory);
     Assert.AreEqual("1725b509-596b-4c0a-a8bc-1f7ccf34fb1a", e.Context.Subject.Key);
     Assert.AreEqual("SubjectUUID", e.Context.Subject.SubjectKeyType);
     Assert.AreEqual("002", e.Context.Subject.Name);
     Assert.AreEqual("Upsert", e.Context.Subject.TransactionType);
     Assert.AreEqual("101", e.Context.Subject.SiteRef.LocationOID);
 }
        /// <summary>
        /// Event fired when a context data is received.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ConversationContextDataReceived(object sender, ContextEventArgs e)
        {
            //Find the RadioButton (using its received name string) and make it checked.
            //The Chart images' visibility property is bound to each RadioButton's checked property. Check MainPage.xaml for details.
            RadioButton receivingRadioButton = FindName(e.ContextData) as RadioButton;

            if (receivingRadioButton != null)
            {
                receivingRadioButton.IsChecked = true;
            }
        }
示例#24
0
        private void ProgramContextReleased(object sender, ContextEventArgs contextEventArgs)
        {
            var programContext = contextEventArgs.Context as IProgramContext;

            if (programContext != null)
            {
                programContext.ProgramStarted -= ProgramContextProgramStarted;
                programContext.ProgramEnded   -= ProgramContextProgramEnded;
                _programContexts.Remove(programContext);
            }
        }
示例#25
0
        private void ProgramContextCreated(object sender, ContextEventArgs contextEventArgs)
        {
            var programContext = contextEventArgs.Context as IProgramContext;

            if (programContext != null)
            {
                _programContexts.Add(programContext);
                programContext.ProgramStarted += ProgramContextProgramStarted;
                programContext.ProgramEnded   += ProgramContextProgramEnded;
            }
        }
示例#26
0
        void NieruchomosciViewInfo_InitContext(object sender, ContextEventArgs args)
        {
            args.Context.Remove(typeof(WParams));
            args.Context.TryAdd(() => new WParams(args.Context));//do filtrów, usuwa stare, dodaje nowe

            if (!args.Context.Contains(typeof(WParams)))
            {
                args.Context.Set((object)new ActualDate(args.Context, Date.Today));
                args.Context.Set(new WParams(args.Context));
            }
        }
 private static void OnContextEvent(ContextEventArgs args, ILogger <IContext> logger)
 {
     if (args.Exception == null)
     {
         logger.LogError("Context-level error: {0}.", args.ErrorInfo);
     }
     else
     {
         logger.LogError(args.Exception, "Context-level error: {0}.", args.ErrorInfo);
     }
 }
示例#28
0
 protected override void OnStartup(ContextEventArgs e)
 {
     base.OnStartup(e);
     if (_abort)
     {
         throw new TerminationException(
                   string.Format(Resources.FileSystemService_TerminationException, _lockfile),
                   TerminationReason.ProcessLocked,
                   CancellationToken.None);
     }
 }
示例#29
0
 protected override void OnUpdate(ContextEventArgs e)
 {
     base.OnUpdate(e);
     if (_abort)
     {
         throw new TerminationException(
                   Resources.SettingsSystemService_TerminationException2,
                   TerminationReason.NoCompatible,
                   CancellationToken.None);
     }
 }
示例#30
0
        void streaming_BufferEnd(object sender, ContextEventArgs e)
        {
            lock (mutex)
            {
                // Unset the bit for the completed buffer
                bufferStatus.Set((int)e.Context, false);

                // Signal to the DecoderThread
                System.Threading.Monitor.Pulse(mutex);
            }
        }
示例#31
0
		private void RuntimeHost_Started(object sender, ContextEventArgs e)
		{
			// Make sure update gets put on the UI thread
			if (this.lblStatus.InvokeRequired)
			{
				this.lblStatus.Invoke(new ContextEventHandler(this.OnRuntimeStarted), new object[] { sender, e });
			}
			else
			{
				this.OnRuntimeStarted(sender, e);
			}
		}
示例#32
0
 private void RuntimeHost_Started(object sender, ContextEventArgs e)
 {
     // Make sure update gets put on the UI thread
     if (this.lblStatus.InvokeRequired)
     {
         this.lblStatus.Invoke(new ContextEventHandler(this.OnRuntimeStarted), new object[] { sender, e });
     }
     else
     {
         this.OnRuntimeStarted(sender, e);
     }
 }
示例#33
0
 void LogHandler(object sender, ContextEventArgs e)
 {
     HttpListenerRequest request = e.Context.Request;
     if (request.HttpMethod.ToUpper() == "GET")
     {
         LogGetHandler(e);
     }
     else if (request.HttpMethod.ToUpper() == "POST")
     {
         LogPostHandler(e);
     }
     e.Context.Response.OutputStream.Close();
 }
示例#34
0
 private static void LogGetHandler(ContextEventArgs e)
 {
     string html = string.Empty;
     using (FileStream fs = new FileStream("Views/Log.html", FileMode.Open))
     {
         using (StreamReader sr = new StreamReader(fs))
         {
             html = sr.ReadToEnd();
         }
     }
     using (StreamWriter sw = new StreamWriter(e.Context.Response.OutputStream))
     {
         sw.Write(html);
     }
 }
示例#35
0
 protected void OnContextReceivedEvent(ContextEventArgs e)
 {
     if (ContextMessageReceived != null)
         ContextMessageReceived(this, e);
 }
示例#36
0
		private void OnRuntimeStarted(object sender, ContextEventArgs e)
		{
			this.lblStatus.Text = "Started";
			this.lblStatus.ForeColor = Color.Green;
		}
示例#37
0
        void streaming_BufferEnd(object sender, ContextEventArgs e)
        {
            lock (mutex)
            {
                // Unset the bit for the completed buffer
                bufferStatus.Set((int)e.Context, false);

                // Signal to the DecoderThread
                System.Threading.Monitor.Pulse(mutex);
            }
        }
        public void srcVoice_BufferStart(object sender, ContextEventArgs e)
        {
            byte[] data = GenPPM();

            ms.SetLength(0);
            ms.Write(data, 0, data.Length);
            ms.Position = 0;

            try
            {
                srcVoice.SubmitSourceBuffer(buffer);
                srcVoice.Start();
            }
            catch
            {
                buffer.Flags = SlimDX.XAudio2.BufferFlags.EndOfStream;
                srcVoice.Stop();
            }
        }
 void TowaryWlasneViewInfo_InitContext(object sender, ContextEventArgs args)
 {
     args.Context.TryAdd(() => new WParams(args.Context));
 }
        /// <summary>
        /// Displays the received context data string in the UI list box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Conversation_ContextDataReceived(object sender, ContextEventArgs e)
        {
            // Does the application Id sent with the context data match the application GUID of this 
            // application?
            if (!e.ApplicationId.Equals(App.AppId))
            {
                return;
            }

            List<Message> messages = ParseMessagesFromContextData(e.ContextData);
            foreach (Message m in messages)
            {
                ShowIncomingTranscriptMessage(m);
            }
        }
示例#41
0
 void sourceVoice_BufferEnd(object sender, ContextEventArgs e)
 {
     if (BufferEnd != null)
         BufferEnd(sender, e);
 }
示例#42
0
 void sourceVoice_BufferEnd(object sender, ContextEventArgs e)
 {
     bufferPlaybackEndEvent.Set();
 }