예제 #1
0
        private async Task HandleStep2 <T>(string str) where T : BaseObjectDateTimeStamps, IEngineeringEntity
        {
            var lst = uow.Query <T>();

            using (var odw = new OracleDatabaseWorker(tbOracleConnectionStringText))
            {
                int i = 0;
                foreach (var item in lst)
                {
                    try
                    {
                        if (!string.IsNullOrWhiteSpace(item.Handle) && long.TryParse(item.Handle, out long gid))
                        {
                            await odw.SetGUIDFromGIDOracleAsync(gid, item.Oid.ToString().ToUpper(), $"SP_NN_{typeof(T).Name}");

                            NewNetServices.Module.Core.StaticHelperMethods.WriteOut($"{typeof(T).Name} {++i}");   // await odw.SetGUIDFromGIDOracleAsync(gid, item.Oid.ToString().ToUpper(), $"SP_NN_{typeof(T).Name}");
                            currentSuccess++;
                            ProgressMade?.Invoke(str, null);
                        }
                    }
                    catch (Exception ex)
                    {
                        currentErrors++;
                        NewNetServices.Module.Core.StaticHelperMethods.WriteOut($" {i}\n{ex}");
                    }
                }
            }
        }
        /// <summary>
        /// Checks whether enough time has passed to determine a new index or to keep the old one.
        /// </summary>
        /// <param name="elapsed">Time in milliseconds that has elapsed since the start of the song.</param>
        /// <param name="obj">Last SongObject that has been analysed.</param>
        /// <returns></returns>
        public static bool IncreaseIndex(double elapsed, SongObject obj)
        {
            lock (_locker)
            {
                if (DevFlags.LoggingEnabled)
                {
                    Logger.AnalyzerLog((obj.TimePosition + obj.Duration) + "/" + elapsed);
                }
                if ((obj.TimePosition + obj.Duration) <= elapsed)
                {
                    SongIndex++;
                }

                float progress = Convert.ToSingle(elapsed / SongDuration);
                if (progress > 1)
                {
                    progress = 1;
                }
                ProgressMade?.Invoke(progress, new EventArgs());

                if (SongIndex >= IndexedSong.Length)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #3
0
 public void DoProgress(int i, string s, bool playSound = false)
 {
     //Progress = i;
     //NotifyMessage = s;
     ProgressMade?.Invoke(this, new ProgressEventArgs()
     {
         Progress = i, Message = s, PlaySound = playSound
     });
 }