Esempio n. 1
0
        public QuestionGridViewModel(IEventAggregator eventAggregator, RoundService roundService, StandingsService standingsService)
        {
            _eventAggregator = eventAggregator;
            _roundService = roundService;
            _standingsService = standingsService;

            AddCommand = new DelegateCommand<object>(AddPoints);
            SubstractCommand = new DelegateCommand<object>(Substract);

            StartCommand = new DelegateCommand(Start);
            StopCommand = new DelegateCommand(Stop);
            BonusCommand = new DelegateCommand(Bonus);
            WrongCommand = new DelegateCommand(Wrong);
            CorrectCommand = new DelegateCommand(Correct);
            CloseCommand = new DelegateCommand(Close);
            BonusAddCommand = new DelegateCommand<object>(AddBonusPoints);

            _showEvent = _eventAggregator.GetEvent<ShowEvent>();
            _activateEvent = _eventAggregator.GetEvent<ActivateEvent>();
            _stopEvent = _eventAggregator.GetEvent<StopEvent>();
            _bonusEvent = _eventAggregator.GetEvent<BonusEvent>();
            _closeEvent = _eventAggregator.GetEvent<CloseEvent>();

            _newSelectorEvent = _eventAggregator.GetEvent<NewSelectorEvent>();
        }
Esempio n. 2
0
        public virtual void Initialize(CloseEvent closeFunction = null, string title = null, bool resizable = false, bool isDialog = true, string category = null, ISkinFile file = null)
        {
            if (category == null)
            {
                category = DefaultCategory;
            }
            if (file == null)
            {
                file = DefaultSkinFile;
            }

            base.Initialize(category, file);

            CanResizeFormHorizontally = resizable;
            CanResizeFormVertically   = resizable;

            Title = title;
            if (title == null)
            {
                Header = false;
            }

            if (closeFunction != null)
            {
                IsClosing += closeFunction;
            }
        }
Esempio n. 3
0
        public void Initialize(DefaultSigmoid _sigmoid, List <Gene> _geneList, CloseEvent closeFunction = null, string title = null, bool resizable = false, bool isDialog = true, string category = null, ISkinFile file = null)
        {
            sigmoid  = _sigmoid;
            geneList = _geneList;

            base.Initialize(closeFunction, title, resizable, isDialog, category, file);
        }
Esempio n. 4
0
        public FileLabel(string path)
        {
            this.FilePath = path;
            InitializeComponent();
            onCloseFile     += new CloseEvent(() => { });
            onClosedFile    += new ClosedEvent(() => { });
            onProgressBegin += new ProgressBeginEvent(() => { });
            onProgressEnd   += new ProgressEndEvent(() => { });
            onAccept        += new AcceptEvent(() => { });

            this.fileName.Content = filePath.Substring(filePath.LastIndexOf("\\") + 1);
            this.Progress.Maximum = 100;

            ImageBrush imgB = new ImageBrush(System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Close1.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()));

            this.btnClose.Background      = imgB;
            this.btnClose.BorderThickness = new Thickness(1);
            this.btnClose.Click          += new RoutedEventHandler((object obj, RoutedEventArgs e) =>
            {
                this.Close();
            });

            this.acceptLabel.MouseLeftButtonUp += new MouseButtonEventHandler((object obj1, MouseButtonEventArgs e1) =>
            {
                this.ProgresBegin();
                this.HiddenAccept();
            });
        }
 public SoundQuestionWindowViewModel(IEventAggregator eventAggregator, StandingsService standingsService, InputService inputService)
     : base(eventAggregator, standingsService, inputService)
 {
     _soundToken = ShowEvent.Subscribe(PauseStart);
     _closeEvent = eventAggregator.GetEvent<CloseEvent>();
     _stopToken = _closeEvent.Subscribe((o) => Dispose());
 }
Esempio n. 6
0
        public void Initialize(List <SpawnPoint> _spawnPointList, IWorld _world, CloseEvent closeFunction = null, string title = null, bool resizable = false, bool isDialog = true, string category = null, ISkinFile file = null)
        {
            spawnPointList = _spawnPointList;
            world          = _world;

            base.Initialize(closeFunction, title, resizable, isDialog, category, file);
        }
Esempio n. 7
0
        private void PageOverview_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                int distSquared = square(e.X - downPos.X) + square(e.Y - downPos.Y);

                if (distSquared < 8 * 8)
                {
                    int w = (int)Math.Max(((this.Width - space) / (float)(space + thumbnailSize)), 1);
                    int l = pageThumbnails.Length + 1;
                    for (int y = 0; y < (float)l / w; y++)
                    {
                        for (int x = 0; x < w; x++)
                        {
                            int ind  = y * w + x;
                            var rect = GetRect(x, y);
                            if (rect.Contains(e.Location))
                            {
                                if (ind < l)
                                {
                                    ItemSelected?.Invoke(this, ind);
                                    CloseEvent?.Invoke();
                                }
                            }
                        }
                    }
                }
            }
        }
        public virtual void CommandFilterTest()
        {
            var webSocketClient = CreateClient(m_Version);

            var oldExecutingCount = CountSubCommandFilterAttribute.ExecutingCount;
            var oldExecutedCount  = CountSubCommandFilterAttribute.ExecutedCount;

            for (int i = 0; i < 100; i++)
            {
                webSocketClient.Send("ECHO " + Guid.NewGuid().ToString());

                if (!this.MessageReceiveEvent.WaitOne(1000))
                {
                    Assert.Fail("Cannot get response in time!");
                }

                Thread.Sleep(10);

                Assert.AreEqual(oldExecutingCount + i + 1, CountSubCommandFilterAttribute.ExecutingCount);
                Assert.AreEqual(oldExecutedCount + i + 1, CountSubCommandFilterAttribute.ExecutedCount);
            }

            webSocketClient.Close();

            if (!CloseEvent.WaitOne(1000))
            {
                Assert.Fail("Failed to close session ontime");
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Edits the lasting recording.
 /// </summary>
 /// <param name="title">Title.</param>
 /// <param name="userData">User data.</param>
 /// <param name="evt">Evt.</param>
 public static void editLastingRecording(string title, Hashtable userData, CloseEvent evt)
 {
                 #if UNITY_IPHONE
     ShareRECIOS.editLastRecording(title, userData, evt);
                 #elif   UNITY_ANDROID
                 #endif
 }
Esempio n. 10
0
        public FileLabel(string path)
        {
            this.FilePath = path;
            InitializeComponent();
            onCloseFile += new CloseEvent(() => { });
            onClosedFile += new ClosedEvent(() => { });
            onProgressBegin += new ProgressBeginEvent(() => { });
            onProgressEnd += new ProgressEndEvent(() => { });
            onAccept += new AcceptEvent(() => { });

            this.fileName.Content = filePath.Substring(filePath.LastIndexOf("\\") + 1);
            this.Progress.Maximum = 100;

            ImageBrush imgB = new ImageBrush(System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Close1.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()));
            this.btnClose.Background = imgB;
            this.btnClose.BorderThickness = new Thickness(1);
            this.btnClose.Click += new RoutedEventHandler((object obj, RoutedEventArgs e) =>
            {
                this.Close();
            });

            this.acceptLabel.MouseLeftButtonUp += new MouseButtonEventHandler((object obj1, MouseButtonEventArgs e1) =>
            {
                this.ProgresBegin();
                this.HiddenAccept();
            });
        }
Esempio n. 11
0
        private void Disconnect()
        {
            if (ConnectionState.Disconnected == _state)
            {
                return;
            }
            Debug.Log("[Session.Disconnect] session state:" + _state + ", disconnect state:" + _disconnectState);
            try
            {
                _state = ConnectionState.Disconnected;
                _timer.Stop();

                if (null == _socket)
                {
                    return;
                }
                //_socket.Shutdown(SocketShutdown.Send);
                //_socket.BeginDisconnect(false, new AsyncCallback(Callback_Disconnect), _socket);
                _socket.Close();
                CloseEvent evt = new CloseEvent(this);
                lock (_sync_obj)
                {
                    _event_queue.Add(evt);
                }
            }
            catch (SocketException e)
            {
                Debug.LogError("[Session.Disconnect] exception:" + e.ToString());
                Error(new Gamnet.Exception(ErrorCode.UndefinedError, e.ToString()));
            }
            catch (ObjectDisposedException e)
            {
                Debug.LogError("[Session.Disconnect] exception:" + e.ToString());
            }
        }
Esempio n. 12
0
        private void ListenerThread()
        {
            m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            m_Socket.Bind(m_Binding);
            m_Socket.Listen(5);
            Socket new_connection = null;

            do
            {
                new_connection = null;
                try {
                    new_connection = m_Socket.Accept();
                }
                catch (SocketException) {
                }
                if (new_connection == null)
                {
                    break;
                }
                if (NewConnectionEvent != null)
                {
                    NewConnectionEvent.Invoke(this, new NewConnectionEventArgs(new_connection));
                }
                else
                {
                    new_connection.Close();
                }
            } while(true);
            m_Socket = null;

            if (CloseEvent != null)
            {
                CloseEvent.Invoke(this, new ListenerCloseEventArgs());
            }
        }
Esempio n. 13
0
 private void WindowOnOkEvent(object sender, OkEventArgs e)
 {
     if (!UserSettings.Wifi)
     {
         MessageBox message = new MessageBox();
         message.SetPrompt("WIFI");
         message.SetCloseTime(2);
         message.configure = _configure;
         if (NetworkInterfaces.Test())
         {
             message.SetMessage("首先你要有无线网卡");
             message.Show();
             return;
         }
         if (User.Text.Length < 1)
         {
             message.SetMessage("名称不能为空");
             message.Show();
             return;
         }
         if (Password.Text.Length <= 7)
         {
             message.SetMessage("密码长度不能小于8位数");
             message.Show();
             return;
         }
         string [] strings = new string[2];
         strings[0] = new string(User.Text.ToCharArray());
         strings[1] = new string(Password.Text.ToCharArray());
         Openwifi(strings);
         message.SetMessage("已创建热点");
         message.Show();
     }
     CloseEvent?.Invoke(this, new OkEventArgs());
 }
Esempio n. 14
0
 private void SpreadsheetGUI_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (crossed == true)
     {
         crossed = false;
         CloseEvent?.Invoke();
     }
 }
Esempio n. 15
0
 protected override void Process(CloseEvent data)
 {
     Ticket.FechaFin = data.Date;
     Ticket.Estado   = Ticket.Estados.Cerrado;
     DaoFactory.TicketDAO.SaveOrUpdate(Ticket);
     SaveMessage(MessageCode.CicloLogisticoCerrado.GetMessageCode(), data.Date.AddSeconds(1));
     ClearGeocercasCache();
 }
Esempio n. 16
0
        public void Initialize(Dictionary <string, object> _valueHolder, CloseEvent closeFunction = null, string title = null, bool resizable = false, bool isDialog = true, string category = null, ISkinFile file = null)
        {
            valueHolder = _valueHolder;

            chromosome = (RMP_Chromosome)valueHolder["RMP_Chromosome"];

            base.Initialize(closeFunction, title, resizable, isDialog, category, file);
        }
Esempio n. 17
0
 private void triggerSavedImage(CloseEvent closeEvent, Uri file)
 {
     closeHandler handler = onSavedImage;
     if (handler != null)
     {
         handler(closeEvent, file);
     }
 }
Esempio n. 18
0
                private void StockClient_onClose(object sender, CloseEvent e) {
			if (logger.IsWarnEnabled) logger.WarnFormat("[QuoteService.onClose] QuoteService disconnected... remoteIP={0}, remotePort={1}", e.RemoteIP, e.Port);
			e.Message = "與伺服器中斷連線,請檢查網路設定。";

			OnDisconnect(new QuoteDisconnectEvent(this.DataSource, e.RemoteIP, e.Port));

			ReLogin(); //重新登入伺服器
		}
Esempio n. 19
0
        public static EditDoubleForm ShowDialogue(Window window, double value, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new EditDoubleForm();

            form.Initialize(value, closeFunction, "Edit Double", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 20
0
        public static EditANNForm ShowDialogue(Window window, INeuralNet _ann, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new EditANNForm();

            form.Initialize(_ann, closeFunction, "Edit ANN", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 21
0
        private void triggerSavedImage(CloseEvent closeEvent, Uri file)
        {
            closeHandler handler = onSavedImage;

            if (handler != null)
            {
                handler(closeEvent, file);
            }
        }
Esempio n. 22
0
        public static NewSimulationForm ShowDialogue(Window window, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new NewSimulationForm();

            form.Initialize(closeFunction, "New Simulation", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 23
0
        public static EditEntityForm ShowDialogue(Window window, IEntity _entity, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new EditEntityForm();

            form.Initialize(_entity, closeFunction, "Edit Entity", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 24
0
        public static ManageGenomeTemplatesForm ShowDialogue(Window window, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new ManageGenomeTemplatesForm();

            form.Initialize(closeFunction, "Manage Genome-Templates", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 25
0
        public static EditWorldForm ShowDialogue(Window window, IWorld _world, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new EditWorldForm();

            form.Initialize(_world, closeFunction, "Edit World-Template", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 26
0
        public static CreateWorldTemplateForm ShowDialogue(Window window, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new CreateWorldTemplateForm();

            form.Initialize(closeFunction, "Create World-Template", true, true, category, file);
            form.Show(window);

            return(form);
        }
Esempio n. 27
0
        private static CloseEvent GetCloseEvent(Loan loan)
        {
            var closeEvent = new CloseEvent();

            closeEvent.Code      = "LOCE";
            closeEvent.LoanId    = loan.Id;
            closeEvent.UserId    = User.CurrentUser.Id;
            closeEvent.EventDate = TimeProvider.Now;
            return(closeEvent);
        }
Esempio n. 28
0
 private void CloseButton_Click(object sender, EventArgs e)
 {
     if (CloseEvent != null)
     {
         CloseEvent.Invoke();
         return;
     }
     _target.Close();
     _target.Dispose();
 }
Esempio n. 29
0
        public void SendBinaryMessageTest()
        {
            try
            {
                WebSocketServer.NewDataReceived -= new SessionHandler <WebSocketSession, byte[]>(WebSocketServer_NewDataReceived);

                var webSocketClient = CreateClient(Version);

                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < 10; i++)
                {
                    sb.Append(Guid.NewGuid().ToString());
                }

                string messageSource = sb.ToString();

                Random rd = new Random();

                for (int i = 0; i < 100; i++)
                {
                    int startPos = rd.Next(0, messageSource.Length - 2);
                    int endPos   = rd.Next(startPos + 1, messageSource.Length - 1);

                    string message = messageSource.Substring(startPos, endPos - startPos);
                    var    data    = Encoding.UTF8.GetBytes("ECHO " + message);

                    webSocketClient.Send(data, 0, data.Length);

                    Console.WriteLine("Client:" + message);

                    if (!MessageReceiveEvent.WaitOne(1000))
                    {
                        Assert.Fail("Cannot get response in time!");
                    }

                    Assert.AreEqual(message, CurrentMessage);
                }

                webSocketClient.Close();

                if (!CloseEvent.WaitOne(1000))
                {
                    Assert.Fail("Failed to close session ontime");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                WebSocketServer.NewDataReceived += new SessionHandler <WebSocketSession, byte[]>(WebSocketServer_NewDataReceived);
            }
        }
Esempio n. 30
0
 private void WindowOnOkEvent(object sender, OkEventArgs okEventArgs)
 {
     _configure.Write();
     SelfStarting.SetSelfStarting(_configure.SelfStarting, "Clock.exe");
     message.configure = _configure;
     message.SetPrompt("设置");
     message.SetMessage("已更改配置");
     message.SetCloseTime(2);
     message.Show();
     CloseEvent?.Invoke(this, new OkEventArgs());
 }
Esempio n. 31
0
        public CloseEvent SaveCloseEvent(CloseEvent closeEvent, IDbTransaction tx)
        {
            const string query = @"
                insert into  dbo.ContractEvents (event_type, contract_id, event_date, user_id, is_deleted, entry_date)
                values (@Code, @LoanId, @EventDate, @UserId, 0, getdate())
                select cast(scope_identity() as int)
            ";

            closeEvent.Id = tx.Connection.Query <int>(query, closeEvent, tx).First();
            return(closeEvent);
        }
Esempio n. 32
0
 protected void OnClick()
 {
     IsOpen = false;
     OnDismiss.InvokeAsync(EventCallback.Empty);
     BSAlertEvent = new BSAlertEvent()
     {
         Target = this
     };
     CloseEvent.InvokeAsync(BSAlertEvent);
     EventQue.Add(ClosedEvent);
 }
Esempio n. 33
0
        /// <summary>
        /// Open the specified title, userData, pageType and evt.
        /// </summary>
        /// <param name="title">Title.</param>
        /// <param name="userData">User data.</param>
        /// <param name="pageType">Page type.</param>
        /// <param name="evt">Evt.</param>
        public static void openSocial(string title, Hashtable userData, SocialPageType pageType, CloseEvent evt)
        {
            _closeHandler = evt;

            string userDataStr = null;

            if (userData != null)
            {
                userDataStr = MiniJSON.jsonEncode(userData);
            }
            __iosShareRECSocialOpen(title, userDataStr, (int)pageType, _callbackObjectName);
        }
Esempio n. 34
0
        /// <summary>
        /// Edits the last recording.
        /// </summary>
        /// <param name="title">Title.</param>
        /// <param name="userData">User data.</param>
        /// <param name="evt">Evt.</param>
        public static void editLastRecording(string title, Hashtable userData, CloseEvent evt)
        {
            _closeHandler = evt;

            string userDataStr = null;

            if (userData != null)
            {
                userDataStr = MiniJSON.jsonEncode(userData);
            }

            __iosShareRECEditLastRecording(title, userDataStr, _callbackObjectName);
        }
        public SoundQuestionWindowView(SoundQuestionWindowViewModel viewModel)
        {
            InitializeComponent();
            this.DataContext = viewModel;

            closeEvent = viewModel.EventAggregator.GetEvent<CloseEvent>();
            token = closeEvent.Subscribe((o) =>
                                                                                   {
                                                                                       System.Diagnostics.Trace.WriteLine("Close stop event");
                                                                                       viewModel.Stop();
                                                                                       viewModel.Dispose();

                                                                                       this.Close();
                                                                                       this.Close();
                                                                                       this.Close();
                                                                                   }, ThreadOption.UIThread, true);
            System.Diagnostics.Trace.WriteLine(token);

            this.PreviewKeyDown += ((QuestionWindowViewModel)DataContext).InputService.ButtonDownEventHandler;
            this.PreviewKeyUp += ((QuestionWindowViewModel)DataContext).InputService.ButtonUpEventHandler;
        }
        public VideoQuestionWindowView(VideoQuestionWindowViewModel viewModel)
        {
            InitializeComponent();
            this.DataContext = viewModel;

            closeEvent = viewModel.EventAggregator.GetEvent<CloseEvent>();
            token = closeEvent.Subscribe((o) =>
                                                                                   {
                                                                                       viewModel.Stop();
                                                                                       viewModel.Dispose();
                                                                                       this.Close();
                                                                                       this.Close();
                                                                                       this.Close();
                                                                                   }, ThreadOption.UIThread, true);

            viewModel.PlayRequested += (sender, e) => UIHelperService.ExecuteUIAction(() => this.Video.Play());
            viewModel.PauseRequested += (sender, e) => UIHelperService.ExecuteUIAction(() => this.Video.Pause());
            viewModel.StopRequested += (sender, e) => UIHelperService.ExecuteUIAction(() => this.Video.Stop());

            System.Diagnostics.Trace.WriteLine(token);

            this.PreviewKeyDown += ((QuestionWindowViewModel)DataContext).InputService.ButtonDownEventHandler;
            this.PreviewKeyUp += ((QuestionWindowViewModel)DataContext).InputService.ButtonUpEventHandler;
        }