Ejemplo n.º 1
0
        async Task ITokenCacheInternal.OnBeforeWriteAsync(TokenCacheNotificationArgs args)
        {
#pragma warning disable CS0618 // Type or member is obsolete, but preserve old behavior until it is deleted
            HasStateChanged = true;
#pragma warning restore CS0618 // Type or member is obsolete
            args.HasStateChanged = true;
            BeforeWrite?.Invoke(args);

            if (AsyncBeforeWrite != null)
            {
                await AsyncBeforeWrite.Invoke(args).ConfigureAwait(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Increases the number of messages.
        /// </summary>
        /// <param name="logEvent">The logging event.</param>
        protected override void Write(LogEventInfo logEvent)
        {
            if (BeforeWrite != null)
            {
                BeforeWrite.Invoke(null, null, Thread.CurrentThread.ManagedThreadId);
            }

            if (EventWritten != null)
            {
                var rendered = Layout == null ? null : Layout.Render(logEvent);
                EventWritten.Invoke(logEvent, rendered, Thread.CurrentThread.ManagedThreadId);
            }
        }
Ejemplo n.º 3
0
        public void Write(Dictionary <Component, List <Context> > componentContexts)
        {
            BeforeWrite?.Invoke();

            foreach (Identifier id in ContractWriters.ContractIds)
            {
                Contracts[id] = ContractWriters.WriteContract(id);
            }

            foreach (Component component in componentContexts.Keys)
            {
                BeforeComponentWrite?.Invoke(component);
                WriteComponent(component, componentContexts[component]);
                AfterComponentWrite?.Invoke(component);
            }

            AfterWrite?.Invoke();
        }
Ejemplo n.º 4
0
        internal void Write(int p, byte value)
        {
            var args = pool.Pop();

            args.Position = p;
            args.Value    = data[p];

            BeforeWrite?.Invoke(this, args);
            if (!Trust)
            {
                Spy.Protect.HealMe(this);
            }
            data[p]    = value;
            args.Value = value;
            AfterWrite?.Invoke(this, args);

            pool.Push(args);
        }
 /// <summary>
 /// Saves the specified data <paramref name="dataToSerialize"/>.
 /// </summary>
 /// <param name="dataToSerialize">Data to be serialized.</param>
 /// <exception cref="System.InvalidOperationException">An error occurred during serialization. The original exception is available using the System.Exception.InnerException property.</exception>
 /// <exception cref="System.UnauthorizedAccessException:">Access is denied.</exception>
 /// <exception cref="System.ArgumentException">path is an empty string(""). -or- path contains the name of a system device (com1, com2, and so on)</exception>
 /// <exception cref="System.ArgumentNullException">path is null.</exception>
 /// <exception cref="System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive.</exception>
 /// <exception cref="System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.
 /// For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
 /// </exception>
 /// <exception cref="System.IO.IOException">path includes an incorrect or invalid syntax for file name, directory name, or volume label syntax.</exception>
 /// <exception cref="System.Security.SecurityException">The caller does not have the required permission.</exception>
 protected void Save(Type4Serialization modelDesign)
 {
     try
     {
         XmlFile.DataToSerialize <Type4Serialization> dataToSerialize = PrepareDataToSerialize(modelDesign);
         GraphicalUserInterface.UseWaitCursor = true;
         BeforeWrite?.Invoke(this, new StringEventArgs(DefaultFileName));
         XmlFile.WriteXmlFile <Type4Serialization>(dataToSerialize.Data, DefaultFileName, FileMode.Create, dataToSerialize.StylesheetName, dataToSerialize.XmlNamespaces);
         ChangesArePresent = false;
     }
     catch (Exception ex)
     {
         GraphicalUserInterface.MessageBoxShowExclamation(ex.Message, Properties.Resources.SolutionFileSaveError);
     }
     finally
     {
         GraphicalUserInterface.UseWaitCursor = false;
     }
 }
Ejemplo n.º 6
0
        public async Task WriteAsync(Dictionary <Component, List <Context> > componentContexts)
        {
            BeforeWrite?.Invoke();

            foreach (Identifier id in ContractWriters.ContractIds)
            {
                Contracts[id] = ContractWriters.WriteContract(id);
                await Task.Yield();
            }

            foreach (Component component in componentContexts.Keys)
            {
                WriteComponent(component, componentContexts[component]);
                await Task.Yield();
            }

            AfterWrite?.Invoke();

            Contracts.Clear();
            ContextContracts.Clear();
        }
Ejemplo n.º 7
0
 void IPointSource <T> .WritePoints(ushort startAddress, T[] points)
 {
     BeforeWrite?.Invoke(this, new PointEventArgs <T>(startAddress, points));
     WritePoints(startAddress, points);
     AfterWrite?.Invoke(this, new PointEventArgs(startAddress, (ushort)points.Length));
 }
Ejemplo n.º 8
0
 internal void OnBeforeWrite(TokenCacheNotificationArgs args)
 {
     HasStateChanged = true;
     BeforeWrite?.Invoke(args);
 }
Ejemplo n.º 9
0
 public void Write(byte b)
 {
     BeforeWrite?.Invoke(b);
     ApplicationExtensions.InvokeInUIThread(() => utfDecoder.Feed(b));
 }
 private void Save(XmlFile.DataToSerialize <Type4Serialization> cd)
 {
     BeforeWrite?.Invoke(this, new StringEventArgs(DefaultFileName));
     XmlFile.WriteXmlFile <Type4Serialization>(cd.Data, DefaultFileName, FileMode.Create, cd.StylesheetName, cd.XmlNamespaces);
     ChangesArePresent = false;
 }
 public void OnBeforeWrite(TokenCacheNotificationArgs args)
 {
     BeforeWrite?.Invoke(args);
 }
 public void Write(byte b)
 {
     BeforeWrite?.Invoke(b);
     utfDecoder.Feed(b);
 }