예제 #1
0
 /// <summary>
 /// execute action when token id is same.
 /// </summary>
 /// <param name="token"></param>
 /// <param name="action"></param>
 public static void Select(EventToken token, string tokenID, Action <EventTokenTrigger> action)
 {
     if (token is EventTokenTrigger tt && tt.TokenID.Equals(tokenID))
     {
         action(tt);
     }
 }
예제 #2
0
 /// <summary>
 /// execute action when token id is same (to see multi token id)
 /// </summary>
 /// <param name="token"></param>
 /// <param name="tokenIDs"></param>
 /// <param name="func"></param>
 public static void Select(EventToken token, string[] tokenIDs, Action <EventTokenTrigger> func)
 {
     foreach (var tokenID in tokenIDs)
     {
         Select(token, tokenID, func);
     }
 }
예제 #3
0
 public static void Select(EventToken token, Action <EventTokenPartsMovingTrigger> func)
 {
     if (token is EventTokenPartsMovingTrigger tt)
     {
         func(tt);
     }
 }
예제 #4
0
        private void StartAnimBtn_Click(object sender, RoutedEventArgs e)
        {
            // Create an ease for use with animations later
            ExponentialEase ExpEaseOut =
                new ExponentialEase()
            {
                EasingMode = EasingMode.EaseOut
            };

            // Animate a UIElement along the X axis from 0 to 40
            Oli.MoveXOf(rect).From(0).To(40).For(0.3, OrSo.Secs).Now();

            // Rotate UIElement to 90 degrees
            EventToken rotating =
                Oli.Rotate(rect).To(90).For(0.3, OrSo.Secs).With(ExpEaseOut).Now();

            // Fade the opacity to 0 after the rotation finishes
            Oli.Fade(rect).To(0).For(0.3, OrSo.Secs).With(ExpEaseOut).After(rotating);

            // Run arbitrary code after the rotation too!
            Oli.Run(() =>
            {
                // Do things here!
            }).After(rotating);
        }
예제 #5
0
 /// <summary>
 /// add token
 /// </summary>
 /// <param name="token"></param>
 public void AddToken(EventToken token)
 {
     lock (_tokenQueue)
     {
         _tokenQueue.Enqueue(token);
     }
 }
예제 #6
0
 public Cpu80186(ILogger <Cpu80186> logger,
                 EventToken eventToken,
                 MemoryController memoryController,
                 DeviceManager devices,
                 ProgrammableInterruptTimer8253 pit,
                 ProgrammableInterruptController8259 pic)
     : base(logger, eventToken, memoryController, devices, pit, pic)
 {
 }
예제 #7
0
 /// <summary>
 /// execute action when control name is equal to the specified one.
 /// </summary>
 /// <param name="token"></param>
 /// <param name="name">UWP control name</param>
 /// <param name="action"></param>
 public static void Select(EventToken token, string name, Action <ControlEventTokenTrigger> action)
 {
     if (token is ControlEventTokenTrigger tt)
     {
         if (tt.Name.Equals(name))
         {
             action.Invoke(tt);
         }
     }
 }
예제 #8
0
 public static void Select(EventToken token, string tokenID, Action <EventTokenPartsMovingTrigger> func)
 {
     if (token is EventTokenPartsMovingTrigger tt)
     {
         if (tt.TokenID.Equals(tokenID))
         {
             func(tt);
         }
     }
 }
예제 #9
0
 public Cpu8086(ILogger <Cpu8086> logger,
                EventToken eventToken,
                MemoryController memoryController,
                DeviceManager devices,
                ProgrammableInterruptTimer8253 pit,
                ProgrammableInterruptController8259 pic)
     : base(logger, memoryController, pit, pic)
 {
     this.eventToken = eventToken;
     this.devices    = devices;
 }
예제 #10
0
 /// <summary>
 /// add a linked event token to throw to other features.
 /// </summary>
 /// <param name="previousToken">previous token</param>
 /// <param name="token">throw new token</param>
 public void Link(EventToken previousToken, EventToken token)
 {
     if (previousToken == null)
     {
         AddNew(token);
     }
     else
     {
         token.Previous = previousToken;
         _parent.View.AddToken(token);
     }
 }
예제 #11
0
        /// <summary>
        /// Save data as Json format
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public async Task LoadFromJson(StorageFile file, EventToken token)
        {
            ClearInstance();
            var templateNo    = 0;
            var templateNoMax = 0;
            var alltxt        = await FileIO.ReadTextAsync(file);

            alltxt = alltxt.Replace("\r\n", "");
            alltxt = alltxt.Replace("\r", "");
            alltxt = alltxt.Replace("\n", "");
            var txts = alltxt.Split(SEPARATOR);

            for (var i = 1; i < txts.Length; i++)
            {
                var json = txts[i].Trim();
                if (templateNo >= 1 && templateNo <= templateNoMax)
                {
                    RestoreTemplate(json);
                    templateNo++;
                    continue;
                }
                var obj = JsonConvert.DeserializeObject(json);
                if (obj is JObject jo && jo.First is JProperty jp && jp.Value is JValue jv)
                {
                    switch (jp.Name)
                    {
                    case "TemplateList.Count":
                    {
                        templateNoMax = jv.Value <int>();
                        templateNo    = 1;
                        break;
                    }

                    case "ActiveTemplate.ID":
                    {
                        var id = jv.Value <string>();
                        Hot.ActiveTemplate = Hot.TemplateList.Where(a => a.ID.Equals(id)).FirstOrDefault();
                        break;
                    }

                    case "Sim.Clock":
                    {
                        var val = jv.Value <DateTime>();
                        Now = val;
                        break;
                    }
                    }
                }
            }
            Finalize(token);
        }
예제 #12
0
 internal EventBuilder(
     ModuleBuilder mod,              // the module containing this EventBuilder
     string name,                    // Event name
     EventAttributes attr,           // event attribute such as Public, Private, and Protected defined above
                                     //int            eventType,                // event type
     TypeBuilder type,               // containing type
     EventToken evToken)
 {
     m_name       = name;
     m_module     = mod;
     m_attributes = attr;
     m_evToken    = evToken;
     m_type       = type;
 }
예제 #13
0
 public new bool Start()
 {
     base.Start();
     newPlaylistEventToken = App.Current.EventsBroker.Subscribe <NewPlaylistEvent> ((e) => HandleNewPlaylist(e));
     App.Current.EventsBroker.Subscribe <OpenedProjectEvent> (HandleOpenedProjectChanged);
     App.Current.EventsBroker.Subscribe <OpenedPresentationChangedEvent> (HandleOpenedPresentationChanged);
     App.Current.EventsBroker.Subscribe <PreviousPlaylistElementEvent> (HandlePrev);
     App.Current.EventsBroker.Subscribe <NextPlaylistElementEvent> (HandleNext);
     App.Current.EventsBroker.Subscribe <LoadEventEvent> (HandleLoadPlayEvent);
     App.Current.EventsBroker.Subscribe <LoadCameraEvent> (HandleLoadCameraEvent);
     App.Current.EventsBroker.Subscribe <PlaybackRateChangedEvent> (HandlePlaybackRateChanged);
     App.Current.EventsBroker.Subscribe <TimeNodeChangedEvent> (HandlePlayChanged);
     App.Current.EventsBroker.Subscribe <TogglePlayEvent> (HandleTogglePlayEvent);
     return(true);
 }
예제 #14
0
        public void TestImportProjectThatNeedsEdition()
        {
            bool      openned = false;
            LMProject p       = new LMProject();

            EventToken et = App.Current.EventsBroker.Subscribe <NavigationEvent> ((e) => {
                openned |= e.Name == NewProjectState.NAME;
            });

            importer.ImportFunction = () => p;
            importer.NeedsEdition   = true;
            App.Current.EventsBroker.Publish(new ImportProjectEvent());
            dbMock.Verify(db => db.Store(p, true), Times.Never());
            Assert.IsTrue(openned);

            App.Current.EventsBroker.Unsubscribe <NavigationEvent> (et);
        }
예제 #15
0
        public void TestImportProject()
        {
            bool      openned = false;
            LMProject p       = new LMProject();

            EventToken et = App.Current.EventsBroker.Subscribe <OpenProjectIDEvent> ((OpenProjectIDEvent e) => {
                if (e.Project == p)
                {
                    openned = true;
                }
            });

            importer.ImportFunction = () => p;
            App.Current.EventsBroker.Publish <ImportProjectEvent> (new ImportProjectEvent());
            dbMock.Verify(db => db.Store <LMProject> (p, true), Times.Once());
            Assert.IsTrue(openned);

            App.Current.EventsBroker.Unsubscribe <OpenProjectIDEvent> (et);
        }
예제 #16
0
        public CrtController6845(MemoryController memoryController, EventToken eventToken)
        {
            this.memoryController = memoryController;
            registers             = new byte[0x12];
            buffer         = Array.Empty <short>();
            fillTextBuffer = () => { };

            ChangeResolution(textStartOfs == SpecialOffset.ColorText ?
                             VideoMode.Text80x25Color :
                             VideoMode.Text80x25TextMonochrome);
            if (isWindows)
            {
                SetConsoleOutputCP(437);
                consoleHandle = GetStdHandle(StdOutputHandle);
            }

            var shutdownCancellationToken = eventToken.ShutDown.Token;

            // task to copy the text video memory to the console buffer
            Task = Task.Run(async() =>
            {
                while (!shutdownCancellationToken.IsCancellationRequested)
                {
                    var task = Task.Delay(RefreshDelay, shutdownCancellationToken);
                    if (isWindows)
                    {
                        CopyMemoryToConsoleBuffer();
                    }
                    else
                    {
                        WriteMemoryToConsole();
                    }

                    if (cursorPositionChanged)
                    {
                        cursorPositionChanged = false;
                        SetCursorPosition((registers[RegisterCursorAddrHi] << 8) | registers[RegisterCursorAddrLo]);
                    }

                    await task;
                }
            });
        }
예제 #17
0
        public void TestImportFakeLiveProject()
        {
            bool      openned = false;
            LMProject p       = new LMProject();

            p.Description         = new ProjectDescription();
            p.Description.FileSet = new MediaFileSet();
            p.Description.FileSet.Add(new MediaFile {
                FilePath = Constants.FAKE_PROJECT
            });

            EventToken et = App.Current.EventsBroker.Subscribe <OpenProjectIDEvent> ((OpenProjectIDEvent e) => {
                openned |= e.Project == p;
            });

            importer.ImportFunction = () => p;
            App.Current.EventsBroker.Publish <ImportProjectEvent> (new ImportProjectEvent());
            dbMock.Verify(db => db.Store <LMProject> (p, true), Times.Once());
            guiToolkitMock.Verify(g => g.SelectMediaFiles(It.IsAny <MediaFileSet> ()), Times.Never());
            Assert.IsTrue(openned);

            App.Current.EventsBroker.Unsubscribe <OpenProjectIDEvent> (et);
        }
예제 #18
0
        private void Finalize(EventToken token)
        {
            Hot.ActiveTemplate.UndoRedoCurrenttPointer = 0;
            Token.Link(token, new EventUndoRedoQueueConsumptionTokenTrigger
            {
                Sender  = this,
                Remarks = "Template Changed",
            });

            // neet to exec by Token instead of ListChip Selected
            //if (ReferenceEquals(TargetListView.SelectedItem, token.TargetTemplate) == false)
            //{
            //    TargetListView.SelectedItem = token.TargetTemplate; // for if not called TargetListView_SelectionChanged
            //}
            var at = Hot.ActiveTemplate;

            Hot.ActiveTemplate = null;
            Token.Link(token, new EventTokenTemplateChangedTrigger
            {
                TargetTemplate = at,
                Sender         = this,
                Remarks        = "After Open Study",
            });
        }
예제 #19
0
        public ProgrammablePeripheralInterface8255(ILogger <ProgrammablePeripheralInterface8255> logger,
                                                   EventToken eventToken,
                                                   MemoryController memoryController,
                                                   ProgrammableInterruptTimer8253 pit,
                                                   ProgrammableInterruptController8259 pic)
        {
            this.logger = logger;
            this.pic    = pic;
            this.pit    = pit;
            // IBM PC BIOS fetches the LSB of the Equipment Word from Port 0x60.
            // - Bits 5-4: 0=EGA, 1=CGA 40x25, 2=CGA 80x25, 3=MDA
            // - Bits 3-2=(value + 4) << 12 is memory size (undocumented, but used during POST).
            //   We return the max (64K) although we have much more.
            data[0] = SenseInfo;
            Console.TreatControlCAsInput = true;

            var shutdownCancellationToken = eventToken.ShutDown.Token;

            Task = Task.Run(async() =>
            {
                byte[] scanCodes;
                if (isWindows)
                {
                    scanCodes = Enumerable.Range(0, 256).Select(x => (byte)MapVirtualKey(x, 0)).ToArray();
                }
                else
                {
                    Dictionary <int, int> linuxScanCodes = ReadLinuxScanCodes();
                    scanCodes = Enumerable.Range(0, 256)
                                .Select(x => linuxScanCodes.TryGetValue(x, out var scanCode) ? (byte)scanCode : (byte)0).ToArray();
                }

                while (!shutdownCancellationToken.IsCancellationRequested)
                {
                    await Task.Delay(50, shutdownCancellationToken).ConfigureAwait(false);

                    if (!Console.KeyAvailable)
                    {
                        continue;
                    }

                    var consoleKeyInfo = Console.ReadKey(true);

                    if (consoleKeyInfo.Modifiers == (ConsoleModifiers.Control | ConsoleModifiers.Alt))
                    {
                        if (consoleKeyInfo.Key == ConsoleKey.C)
                        {
                            eventToken.Halt.Cancel();
                        }
                        else if (consoleKeyInfo.Key == ConsoleKey.M)
                        {
                            await File.WriteAllBytesAsync(
                                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Memory.bin"),
                                memoryController.Memory, shutdownCancellationToken);
                        }
                    }

                    if (consoleKeyInfo.Modifiers.HasFlag(ConsoleModifiers.Shift))
                    {
                        PutKey(scanCodes[VK_LSHIFT]);
                        await Task.Delay(20, shutdownCancellationToken).ConfigureAwait(false);
                    }

                    PutKey(scanCodes[(byte)consoleKeyInfo.Key]);
                    if (consoleKeyInfo.Modifiers.HasFlag(ConsoleModifiers.Shift))
                    {
                        await Task.Delay(20, shutdownCancellationToken).ConfigureAwait(false);
                        PutKey((byte)(scanCodes[VK_LSHIFT] | 0x80));
                    }
                }
            });
        }
예제 #20
0
 public new bool Start()
 {
     base.Start ();
     newPlaylistEventToken = App.Current.EventsBroker.Subscribe<NewPlaylistEvent> ((e) => HandleNewPlaylist (e));
     App.Current.EventsBroker.Subscribe<OpenedProjectEvent> (HandleOpenedProjectChanged);
     App.Current.EventsBroker.Subscribe<OpenedPresentationChangedEvent> (HandleOpenedPresentationChanged);
     App.Current.EventsBroker.Subscribe<PreviousPlaylistElementEvent> (HandlePrev);
     App.Current.EventsBroker.Subscribe<NextPlaylistElementEvent> (HandleNext);
     App.Current.EventsBroker.Subscribe<LoadEventEvent> (HandleLoadPlayEvent);
     App.Current.EventsBroker.Subscribe<LoadCameraEvent> (HandleLoadCameraEvent);
     App.Current.EventsBroker.Subscribe<PlaybackRateChangedEvent> (HandlePlaybackRateChanged);
     App.Current.EventsBroker.Subscribe<TimeNodeChangedEvent> (HandlePlayChanged);
     App.Current.EventsBroker.Subscribe<TogglePlayEvent> (HandleTogglePlayEvent);
     return true;
 }
예제 #21
0
파일: Tokens.cs 프로젝트: moayyaed/ikvm
 public bool Equals(EventToken other)
 {
     return(this == other);
 }
예제 #22
0
        public void Setup()
        {
            mockGuiToolkit = new Mock<IGUIToolkit> ();
            App.Current.GUIToolkit = mockGuiToolkit.Object;
            App.Current.JobsManager = mockVideoRenderer.Object;
            mockDiaklogs = new Mock<IDialogs> ();
            App.Current.Dialogs = mockDiaklogs.Object;

            plmanager = new PlaylistManager ();
            plmanager.Start ();
            plmanager.Player = mockPlayerController.Object;

            OpenProject (new ProjectLongoMatch ());
            playlistElementLoaded = false;

            et = App.Current.EventsBroker.Subscribe<PlaylistElementLoadedEvent> ((e) => playlistElementLoaded = true);
        }
예제 #23
0
 public static void Off(EventToken token)
 {
     GetStore(token.EventType).Off(token);
 }
예제 #24
0
        public bool Start()
        {
            openedProjectEventToken = App.Current.EventsBroker.Subscribe<OpenedProjectEvent> ((e) => {
                this.openedProject = e.Project as ProjectLongoMatch;
            });

            App.Current.EventsBroker.Subscribe<MigrateDBEvent> (HandleMigrateDB);
            App.Current.EventsBroker.Subscribe<ExportProjectEvent> (ExportProject);
            App.Current.EventsBroker.Subscribe<ImportProjectEvent> (ImportProject);

            return true;
        }
예제 #25
0
		public bool Equals(EventToken other)
		{
			return this == other;
		}
예제 #26
0
 public static bool op_Inequality(EventToken a, EventToken b)
 {
 }
	public bool Equals(EventToken obj) {}
예제 #28
0
 public void AddDependency(EventToken token) => tokens.Add(token);
예제 #29
0
 /// <summary>
 /// add a new event token to throw other features.(NOTE: Use Link method if you have received token)
 /// </summary>
 /// <param name="newtoken">new token</param>
 public void AddNew(EventToken newtoken)
 {
     newtoken.Previous = null;
     _parent.View.AddToken(newtoken);
 }
예제 #30
0
 /// <summary>
 /// add a linked token in urgent mode.
 /// </summary>
 /// <param name="previousToken"></param>
 /// <param name="token"></param>
 /// <remarks>Use Link method instead of this one. This is for system purpose</remarks>
 public void LinkUrgent(EventToken previousToken, EventTokenTrigger token)
 {
     token.Previous = previousToken;
     _parent.View.AddUrgentToken(token);
 }
예제 #31
0
파일: EventToken.cs 프로젝트: zouql/corert
 public bool Equals(EventToken obj) => obj.Token == Token;
예제 #32
0
 public bool Start()
 {
     multimediaToolkit = App.Current.MultimediaToolkit;
     guiToolkit = App.Current.GUIToolkit;
     App.Current.EventsBroker.Subscribe<OpenProjectIDEvent> (OpenProjectID);
     App.Current.EventsBroker.Subscribe<OpenNewProjectEvent> (OpenNewProject);
     closeOpenedProjectEventToken = App.Current.EventsBroker.Subscribe<CloseOpenedProjectEvent> ((e) => {
         PromptCloseProject (new CloseOpenedProjectEvent ());
     });
     App.Current.EventsBroker.Subscribe<SaveProjectEvent> (HandleSaveProject);
     App.Current.EventsBroker.Subscribe<CaptureErrorEvent> (HandleCaptureError);
     App.Current.EventsBroker.Subscribe<CaptureFinishedEvent> (HandleCaptureFinished);
     App.Current.EventsBroker.Subscribe<MultimediaErrorEvent> (HandleMultimediaError);
     return true;
 }
	public static bool op_Inequality(EventToken a, EventToken b) {}
예제 #34
0
 public bool Equals(EventToken obj)
 {
 }