예제 #1
0
        private List <string> SelectSupportedVehicles(List <string> allVins)
        {
            IVtsWebService service         = Infrastructure.Container.GetInstance <IVtsWebService>();
            List <string>  unsupportedVins = service.
                                             CheckVinsReturnUnsupported(allVins.ToArray()).ToList();
            List <string> result = new List <string>();

            foreach (string vin in allVins)
            {
                if (unsupportedVins.Contains(vin,
                                             StringComparer.InvariantCultureIgnoreCase))
                {
                    // report unsupported vehicle
                    new List <PsaTraceSignature>();
                    List <PsaTrace> tracesToGetSignatures = traceInfos.
                                                            Where(t => t.Trace.Vin == vin).
                                                            Select(t => t.Trace).ToList();
                    List <PsaTraceSignature> signaturesOfTracesForUnsupportedVehicle =
                        GetTraceSignaturesForTracesList(tracesToGetSignatures);
                    StatusUpdated.Invoke(DataSynchronizationStatus.VehicleUnsupported,
                                         signaturesOfTracesForUnsupportedVehicle);
                }
                else
                {
                    result.Add(vin);
                }
            }
            return(result);
        }
예제 #2
0
 private void ExecuteWorkItem()
 {
     if (!this.IsServiceRunning)
     {
         this.IsServiceRunning = true;
         IWorkItem workItem = null;
         lock (lockQueue)
         {
             if (this.workItemQueue.Count > 0)
             {
                 workItem = this.workItemQueue.Dequeue();
             }
         }
         if (workItem != null)
         {
             workItem.WorkItemStatusUpdated += WorkItem_WorkItemStatusUpdated;
             asyncService.DoTask(workItem);
             StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs($"{workItem.Name} - Started"));
         }
         else
         {
             this.IsServiceRunning = false;
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Occurs when data is received from the executing application.
        /// </summary>
        private void FFmpeg_DataReceived(object sender, DataReceivedEventArgs e)
        {
            if (e.Data == null)
            {
                if (!isStarted && isFFmpeg)
                {
                    ParseFileInfo();
                }
                return;
            }

            output.AppendLine(e.Data);
            DataReceived?.Invoke(sender, e);

            if (isFFmpeg)
            {
                if (FileStreams == null && (e.Data.StartsWith("Output ") || e.Data.StartsWith("Press [q] to stop")))
                {
                    ParseFileInfo();
                }
                if (e.Data.StartsWith("Press [q] to stop") || e.Data.StartsWith("frame="))
                {
                    isStarted = true;
                }

                if (isStarted && e.Data.StartsWith("frame="))
                {
                    FFmpegStatus ProgressInfo = FFmpegParser.ParseProgress(e.Data);
                    StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs(ProgressInfo));
                }
            }
        }
예제 #4
0
        public void SendPresence()
        {
            var status = new LeagueStatus(StatusMessage, Status);

            ShowType computed;

            if (DndStatuses.Contains(Status))
            {
                computed = ShowType.dnd;
            }
            else if (ChatMode == ChatMode.Away)
            {
                computed = ShowType.away;
            }
            else
            {
                computed = ShowType.chat;
            }

            var args = new StatusUpdatedEventArgs(status, ChatMode == ChatMode.Invisible ? PresenceType.invisible : PresenceType.available, computed);

            StatusUpdated?.Invoke(this, args);

            if (!connected)
            {
                return;
            }
            xmpp.Send(new Presence(computed, status.ToXML(), 100)
            {
                Type = args.PresenceType
            });
        }
예제 #5
0
 private void Connection_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
 {
     if (args.Request.Message.ContainsKey("CurrentStatus"))
     {
         string currentStatus = args.Request.Message["CurrentStatus"] as string;
         StatusUpdated?.Invoke(this, currentStatus);
     }
 }
예제 #6
0
        private void MarkEverythingAsInProgress()
        {
            List <PsaTrace>          allTraces = traceInfos.Select(ti => ti.Trace).ToList();
            List <PsaTraceSignature> sigs      = GetTraceSignaturesForTracesList(allTraces);

            StatusUpdated.Invoke(DataSynchronizationStatus.InProgress,
                                 sigs);
        }
예제 #7
0
 public void updateStatus(uint position, String status)
 {
     progressBar.Position = position;
     statusText.Caption   = status;
     if (StatusUpdated != null)
     {
         StatusUpdated.Invoke(this);
     }
 }
예제 #8
0
파일: Animal.cs 프로젝트: cureduck/Vows
 internal void TakeHpDmg(int point)
 {
     combatAttr.curHp = Math.Max(0, combatAttr.curHp - point);
     if (combatAttr.curHp == 0)
     {
         Die();
     }
     StatusUpdated?.Invoke();
 }
 private void Delete()
 {
     try {
         Model.Delete();
     } catch (Exception e) {
         _dialogs.Toast(e.Message);
     }
     StatusUpdated?.Invoke();
 }
예제 #10
0
 public void AddWorkItem(IWorkItem workItem)
 {
     lock (lockQueue)
     {
         workItemQueue.Enqueue(workItem);
     }
     StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs($"{workItem.Name} - Added"));
     QueueItemAdded.Invoke(this, null);
 }
예제 #11
0
        public void StartUpdatingStatus()
        {
            while (true)
            {
                var message = $"Status, ticks{DateTime.UtcNow.Ticks}";

                StatusUpdated?.Invoke(message);
            }
        }
예제 #12
0
 public void Remove(string uniqueName)
 {
     if (m_StatusNameTable.ContainsKey(uniqueName))
     {
         m_StatusList.Remove(m_StatusNameTable[uniqueName]);
         m_StatusNameTable.Remove(uniqueName);
         StatusUpdated?.Invoke(Status);
     }
 }
예제 #13
0
 private void Connection_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
 {
     //the Win32 app has sent us a message. If it's the message to confirm that the channel has been open, we raise the StatusUpdated event
     if (args.Request.Message.ContainsKey("Status"))
     {
         string currentStatus = args.Request.Message["Status"].ToString();
         StatusUpdated?.Invoke(this, currentStatus);
     }
 }
예제 #14
0
파일: Functions.cs 프로젝트: ledomone/basd
 public void StartUpdatingStatus()
 {
     while (true)
     {
         var message = $"status, ticks {DateTime.UtcNow.Ticks}";
         StatusUpdated?.Invoke(message);
         StatusUpdatedAgain?.Invoke(this, new StatusEventArgs(message));
         Thread.Sleep(500);
     }
 }
예제 #15
0
 private void MarkTracesAsSynchronized(IList <PsaTrace> tracesToMark)
 {
     StatusUpdated.Invoke(DataSynchronizationStatus.Finished,
                          GetTraceSignaturesForTracesList(tracesToMark));
     foreach (PsaTrace psaTrace in tracesToMark)
     {
         traceInfos.First(ti => ti.Trace.Vin == psaTrace.Vin &&
                          ti.Trace.Date == psaTrace.Date).Metadata.IsSynchronized = true;
     }
 }
예제 #16
0
        private static void UpdateStatus()
        {
            AxisPos1    = pMount.MCGetAxisPosition(AXISID.AXIS1) / RAD1;
            AxisPos2    = pMount.MCGetAxisPosition(AXISID.AXIS2) / RAD1;
            AxisStatus1 = pMount.MCGetAxisStatus(AXISID.AXIS1);
            AxisStatus2 = pMount.MCGetAxisStatus(AXISID.AXIS2);

            //EventInvoker.BeginInvoke(StatusUpdated, null, null, null);
            //StatusUpdated.BeginInvoke(typeof(Controller), null, null, null);
            StatusUpdated.Invoke(typeof(Controller), null);
            //System.Diagnostics.Trace.WriteLine(string.Format("Update Status, {0:f2} {1:f2} {2} {3}", AxisPos1, AxisPos2, AxisStatus1.FullStop, AxisStatus2.FullStop),"INFO");
        }
        public static void OnStatusUpdate(int tag, ref Maid currentMaid, int enumVal, bool value)
        {
            StatusUpdateEventArgs args = new StatusUpdateEventArgs
            {
                Tag        = (MaidChangeType)tag,
                CallerMaid = currentMaid,
                EnumVal    = enumVal,
                Value      = value
            };

            StatusUpdated?.Invoke(null, args);
        }
예제 #18
0
        private void WorkItem_WorkItemStatusUpdated(object sender, WorkItemStatusUpdatedEventArgs e)
        {
            this.IsServiceRunning = e.Status == WorkItemStatus.Running ? true : false;

            if (e.Status == WorkItemStatus.Completed)
            {
                IWorkItem workItem = (IWorkItem)sender;
                workItem.WorkItemStatusUpdated -= WorkItem_WorkItemStatusUpdated;
                StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs($"{workItem.Name} - Completed"));
                StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs($"Queue Count - {this.QueueCount}"));
                ExecuteWorkItem();
            }
        }
예제 #19
0
 public void StartUpdatingStatus()
 {
     while (true)
     {
         if (StatusUpdated != null)
         {
             StatusUpdated($"status with ticks {DateTime.UtcNow.Ticks}");
         }
         StatusUpdated?.Invoke($"status with ticks {DateTime.UtcNow.Ticks}");
         StatusUpdatedAgain?.Invoke(this, new StatusEventArgs("Status event args"));
         Thread.Sleep(500);
     }
 }
예제 #20
0
        public void Redo()
        {
            if (RedoStack.Count == 0)
            {
                return;
            }

            var postStatus = RedoStack.Pop();

            UndoStack.Push(postStatus);
            //event
            CurrentGameStatus = postStatus;
            PokemonSelected(postStatus.ImageType, true);
            StatusUpdated?.Invoke(CurrentGameStatus);
        }
예제 #21
0
        public void Add(string uniqueName, int priority, Status newStatus)
        {
            newStatus = FixStatusDefaults(newStatus);

            if (m_StatusNameTable.ContainsKey(uniqueName))
            {
                m_StatusList.Remove(m_StatusNameTable[uniqueName]);
                m_StatusNameTable.Remove(uniqueName);
            }

            m_StatusList.Add(newStatus, priority);
            m_StatusNameTable.Add(uniqueName, newStatus);

            StatusUpdated?.Invoke(m_StatusList.First());
            AnimationUpdated?.Invoke(m_StatusList.First());
        }
예제 #22
0
        /// <summary>
        /// Occurs when data is received from the executing application.
        /// </summary>
        private void FFmpeg_DataReceived(object sender, DataReceivedEventArgs e)
        {
            if (e.Data == null)
            {
                // We're reading both Output and Error streams, only parse on 2nd null.
                if (!isStarted && encoder != EncoderApp.Other)
                {
                    ParseFileInfo();
                }
                return;
            }

            output.AppendLine(e.Data);
            DataReceived?.Invoke(sender, e);

            if (encoder == EncoderApp.FFmpeg)
            {
                if (FileStreams == null && (e.Data.StartsWith("Output ") || e.Data.StartsWith("Press [q] to stop")))
                {
                    ParseFileInfo();
                }
                if (e.Data.StartsWith("Press [q] to stop") || e.Data.StartsWith("frame="))
                {
                    isStarted = true;
                }

                if (isStarted && e.Data.StartsWith("frame="))
                {
                    FFmpegStatus ProgressInfo = FFmpegParser.ParseFFmpegProgress(e.Data);
                    LastStatusReceived = ProgressInfo;
                    StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs(ProgressInfo));
                }
            }
            else if (encoder == EncoderApp.x264)
            {
                if (!isStarted && e.Data.StartsWith("frames "))
                {
                    isStarted = true;
                }
                else if (isStarted && e.Data.Length == 48)
                {
                    FFmpegStatus ProgressInfo = FFmpegParser.ParseX264Progress(e.Data);
                    LastStatusReceived = ProgressInfo;
                    StatusUpdated?.Invoke(this, new StatusUpdatedEventArgs(ProgressInfo));
                }
            }
        }
예제 #23
0
        /// <summary>
        /// Filter out already synchronized and unsupported data.
        /// </summary>
        private List <PsaTrace> FilterTraces(IEnumerable <PsaTraceInfo> traceInfs)
        {
            List <PsaTrace> result = new List <PsaTrace>();

            foreach (PsaTraceInfo traceInfo in traceInfs)
            {
                if (!traceInfo.Metadata.IsSynchronized &&
                    traceInfo.Trace.Date != DateTime.MinValue &&
                    traceInfo.Trace.ParametersSets.Count > 0)
                {
                    result.Add(traceInfo.Trace);
                }
                else if (traceInfo.Metadata.IsSynchronized)
                {
                    StatusUpdated.Invoke(DataSynchronizationStatus.Finished,
                                         new List <PsaTraceSignature>()
                    {
                        new PsaTraceSignature()
                        {
                            TraceDate = traceInfo.Trace.Date,
                            Vin       = traceInfo.Trace.Vin
                        }
                    });
                    Log.Info(String.Format("Finished sync for trace by {0}, vin: {1}",
                                           traceInfo.Trace.Date, traceInfo.Trace.Vin));
                }
                else if (traceInfo.Trace.Date == DateTime.MinValue ||
                         traceInfo.Trace.ParametersSets.Count == 0)
                {
                    StatusUpdated.Invoke(DataSynchronizationStatus.Failed,
                                         new List <PsaTraceSignature>()
                    {
                        new PsaTraceSignature()
                        {
                            TraceDate = traceInfo.Trace.Date,
                            Vin       = traceInfo.Trace.Vin
                        }
                    });
                    Log.Warn(String.Format(
                                 "Cannot sync trace: Trace for {0} by path {1} has incorrect date or has no Parameter Sets.",
                                 traceInfo.Trace.Vin, traceInfo.Metadata.SourceXmlPath));
                }
            }
            return(result);
        }
        public WorkflowResult Execute(BulkUploadJobContext bulkUploadJobContext)
        {
            try
            {
                var globalBulkUploadFolder = CloudOdsAdminAppSettings.AppSettings.BulkUploadHashCache;

                var instanceBulkUploadFolder =
                    $"{globalBulkUploadFolder}\\{bulkUploadJobContext.OdsInstanceId}";

                var workingFolderPath =
                    _fileUploadHandler.GetWorkingDirectory(instanceBulkUploadFolder);

                var fileImportConfig = new FileImportConfiguration().SetConfiguration(
                    bulkUploadJobContext, workingFolderPath);

                var fileImportService = new FileImportService(
                    fileImportConfig, bulkUploadJobContext.OdsInstanceName, _inferOdsApiVersion);

                var workflowManager = SetupWorkflowManager(bulkUploadJobContext, fileImportService);
                return(workflowManager.Execute());
            }
            catch (Exception ex)
            {
                var errorMessage = $"An error occured while initializing the file importer: {ex.Message}";
                var status       = new WorkflowStatus
                {
                    Complete     = true,
                    CurrentStep  = 0,
                    TotalSteps   = 0,
                    Error        = true,
                    ErrorMessage = errorMessage,
                };
                StatusUpdated?.Invoke(status);

                return(new WorkflowResult
                {
                    Error = true,
                    ErrorMessage = errorMessage,
                    TotalSteps = 0,
                    StepsCompletedSuccessfully = 0,
                });
            }
        }
예제 #25
0
        public void Undo()
        {
            if (UndoStack.Count == 0)
            {
                return;
            }

            var preStatus = UndoStack.Pop();

            RedoStack.Push(preStatus);
            CurrentGameStatus = preStatus;
            PokemonSelected(new PokemonImageType()
            {
                PokemonType = PokemonType.None, Image = ""
            }, true);
            CurrentGameStatus = preStatus;

            StatusUpdated?.Invoke(CurrentGameStatus);
        }
예제 #26
0
        /// <summary>
        /// Send a the command to the VLC media player.
        /// </summary>
        /// <param name="query">The query to send. If a null query is provided, just an updated status
        /// will be requested.</param>
        private async Task SendCommand(string query = null)
        {
            HttpResponseMessage response = null;

            try
            {
                response = await client.GetAsync("requests/status.xml" + (query == null ? "" : "?" + query));
            }
            catch (HttpRequestException)
            {
                IsConnected = false;
                ConnectionChanged?.Invoke(this, new EventArgs());
                return;
            }

            IsConnected = true;

            if (response.IsSuccessStatusCode)
            {
                var stream = await response.Content.ReadAsStreamAsync();

                try
                {
                    Status = (VlcStatus)statusSerializer.Deserialize(stream);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                StatusUpdated?.Invoke(this, new EventArgs());
            }
            else if (response.StatusCode == HttpStatusCode.Unauthorized)
            {
                IsConnected = false;
                ConnectionChanged?.Invoke(this, new EventArgs());
            }
            else
            {
                Console.WriteLine("error: " + response.StatusCode);
            }
        }
예제 #27
0
 private bool SynchronizeDatasets(List <PsaDataset> datasetsToUpload)
 {
     foreach (PsaDataset dataset in datasetsToUpload)
     {
         PsaDatasetDto dto = PsaDatasetAssembler.FromDomainobjectToDto(dataset);
         try
         {
             VtsWebServiceClient service = new VtsWebServiceClient();
             service.UploadDataset(dto);
             MarkTracesAsSynchronized(dataset.Traces);
         }
         catch (Exception e)
         {
             StatusUpdated.Invoke(DataSynchronizationStatus.Failed,
                                  GetTraceSignaturesForDataset(dataset));
             Log.Error(e, e.Message);
         }
     }
     return(true);
 }
예제 #28
0
        private void ReceiveTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (udpClient.Available > 0)
            {
                IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
                byte[]     receiveBytes     = udpClient.Receive(ref RemoteIpEndPoint);
                if (receiveBytes.Length != 68)
                {
                    return;
                }

                BinaryReader reader = new BinaryReader(new MemoryStream(receiveBytes), Encoding.ASCII);

                UInt16 packNum = reader.ReadUInt16();
                io_and_flag = reader.ReadUInt32();
                cx          = reader.ReadInt32();
                cy          = reader.ReadInt32();
                cz          = reader.ReadInt32();
                ca          = reader.ReadInt32();
                Int32 cb = reader.ReadInt32();
                Int32 cc = reader.ReadInt32();
                reader.ReadInt32();
                reader.ReadInt32();
                reader.ReadInt32();
                ux = reader.ReadInt16();
                uy = reader.ReadInt16();
                uz = reader.ReadInt16();
                ua = reader.ReadInt16();

                byte limStatus = (byte)((io_and_flag >> 1) & 0xFF);
                lx = (limStatus & 1) > 0;
                ly = (limStatus & 4) > 0;
                lz = (limStatus & 8) > 0;
                la = (limStatus & 2) > 0;

                if (StatusUpdated != null)
                {
                    StatusUpdated.Invoke(this, null);
                }
            }
        }
예제 #29
0
        private void Heartbeat(object state)
        {

            if (!_socket.Connected && IsConnected)
            {
                DeviceDisconnected?.Invoke();
                IsConnected = false;
            }

            if (!IsConnected)
            {
                // Try reconnect
                try
                {
                    ConnectSocket();
                    DeviceConnected?.Invoke();

                }
                catch (Exception e)
                {
                    IsConnected = false;
                }
            }

            try
            {
                var response = Ping();

                Span<byte> statusSpan = Serialize<DacStatusDto>(response.DacStatus);

                var dacStatus = DacStatus.ParseDacStatus(statusSpan);

                var ack = DacResponse.ParseAckCode(response.Response);     

                StatusUpdated?.Invoke(ack, dacStatus.BufferFullness);
            }
            catch (Exception e)
            {

            }
        }
예제 #30
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
                if (!ApplicationData.Current.LocalSettings.Values.ContainsKey("Status"))
                {
                    ApplicationData.Current.LocalSettings.Values.Add("Status", "Available");
                }
                StatusUpdated?.Invoke(this, ApplicationData.Current.LocalSettings.Values["Status"].ToString());
            }
        }