public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            timeLoggingController = TimeLoggingController.GetInstance();
            stateHandler          = new StateChangedEventHandler(timeLoggingStateChanged);

            activityView                  = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            activityView.Frame            = View.Frame;
            activityView.BackgroundColor  = UIColor.FromRGBA(0, 0, 0, 0.6f);
            activityView.Center           = View.Center;
            activityView.HidesWhenStopped = true;
            View.AddSubview(activityView);

            completeBtn.TouchUpInside += delegate
            {
                newCompleteDatePicker();
                completedDateText.BecomeFirstResponder();
            };

            projectNameBtn.TitleLabel.TextAlignment             = UITextAlignment.Center;
            projectNameBtn.TitleLabel.Lines                     = 2;
            projectNameBtn.TitleLabel.AdjustsFontSizeToFitWidth = true;

            taskNameBtn.TitleLabel.TextAlignment             = UITextAlignment.Center;
            taskNameBtn.TitleLabel.Lines                     = 3;
            taskNameBtn.TitleLabel.AdjustsFontSizeToFitWidth = true;

            projectNameBtn.TouchUpInside += ProjectNameBtnOnClick;
            taskNameBtn.TouchUpInside    += TaskNameBtnOnClick;
            pauseBtn.TouchUpInside       += PauseBtnOnClick;
            playBtn.TouchUpInside        += PlayBtnOnClick;
        }
Exemple #2
0
        static PDashAPI()
        {
            var apiService = new ApiTypes(null);
            var service    = new PDashServices(apiService);

            Controller          = new RobustController(service);
            stateChangedHandler = new StateChangedEventHandler(iOSTimeLoggingStateChanged);
            TimeLoggingController.TimeLoggingStateChanged += stateChangedHandler;
        }
Exemple #3
0
        protected virtual void OnToggleStateChanged(StateChangedEventArgs e)
        {
            StateChangedEventHandler handler1 = (StateChangedEventHandler)base.Events[RadMenuItem.ToggleStateChangedEventKey];

            if (handler1 != null)
            {
                handler1(this, e);
            }
        }
Exemple #4
0
        protected virtual void OnToggleStateChanged(StateChangedEventArgs e)
        {
            StateChangedEventHandler handler1 = (StateChangedEventHandler)this.Events[RadToggleButton.StateChangedEventKey];

            if (handler1 != null)
            {
                handler1(this, e);
            }
        }
        /// <summary>
        /// Генерирует событие - изменилось состояние
        /// </summary>
        private void Raise_StateChanged()
        {
            StateChangedEventHandler handler = this.StateChanged;

            if (handler != null)
            {
                handler(this);
            }
        }
        /// <summary>
        /// Генерирует событие - изменилось состояние всей иерархии элементов
        /// </summary>
        protected void Raise_HierarchyStateChanged(OlapMemberInfo sender)
        {
            StateChangedEventHandler handler = this.HierarchyStateChanged;

            if (handler != null)
            {
                handler(sender);
            }
        }
        private static void StateChangeDeleteAdd(int devhandle, string ip, StateChangedEventHandler onDeviceStateChangedEvent)
        {
            DevStateChangeDeleteInfo item = new DevStateChangeDeleteInfo {
                devHandle = devhandle,
                ip        = ip,
                OnDeviceStateChangedEvent = onDeviceStateChangedEvent
            };

            lsDevStateChangeDeleteInfo.Add(item);
        }
Exemple #8
0
        protected virtual void OnToggleStateChanged(StateChangedEventArgs e)
        {
            StateChangedEventHandler changedEventHandler = (StateChangedEventHandler)this.Events[RadToggleButtonElement.StateChangedEventKey];

            if (changedEventHandler == null)
            {
                return;
            }
            changedEventHandler((object)this, e);
        }
Exemple #9
0
        protected virtual void OnStateChanged(StatusEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("LicensMail onStateChanged: " + args.eStatus.ToString() + ":" + args.strMessage);
            StateChangedEventHandler handler = StateChanged;

            if (handler != null)
            {
                handler(this, args);
            }
        }
Exemple #10
0
        protected virtual void OnToggleStateChanged(EventArgs e)
        {
            StateChangedEventHandler changedEventHandler = (StateChangedEventHandler)this.Events[RadToggleButton.StateChangedEventKey];

            if (changedEventHandler != null)
            {
                changedEventHandler((object)this, (StateChangedEventArgs)e);
            }
            this.OnNotifyPropertyChanged("ToggleState");
            this.OnToggleChanged(new EventArgs());
        }
Exemple #11
0
        private async void RaiseOnStateChanged(MqttState State)
        {
            StateChangedEventHandler h = this.OnStateChanged;

            if (h != null)
            {
                try
                {
                    await h(this, State);
                }
                catch (Exception ex)
                {
                    this.Exception(ex);
                }
            }
        }
Exemple #12
0
        public static Action Subscribe <TState>(this IStore store, StateChangedEventHandler <TState> handler) where TState : struct
        {
            Store <TState> realStore = store.GetStore <TState>();

            realStore.StateChanged += handler;
            bool subscribed = true;

            return(() =>
            {
                if (subscribed)
                {
                    realStore.StateChanged -= handler;
                    subscribed = false;
                }
            });
        }
        public MainForm()
        {
            InitializeComponent();

            //check if it is windows 7
            if (Environment.OSVersion.Version.Major < 6)
            {
                MessageBox.Show("This application is optimized for windows 7 or higher");
                Close();
            }

            Load         += OnLoad;
            Closing      += OnClosing;
            StateChanged += new StateChangedEventHandler(Spotify_StateChanged);

            string baseDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

            // Initailize the chromium browser
            var settings = new CefSettings();

            //settings.CefCommandLineArgs.Add("enable-system-flash", "1");
            settings.CachePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DeezerRecorder\\";
            Cef.Initialize(settings);

            ChromiumWebBrowser aboutBrowser = new ChromiumWebBrowser("file://" + baseDir.Replace("\\", "/") + "/about.html");

            tabPageAbout.Controls.Add(aboutBrowser);

            ChromiumWebBrowser helpBrowser = new ChromiumWebBrowser("file://" + baseDir.Replace("\\", "/") + "/help.html");

            tabPageHelp.Controls.Add(helpBrowser);

            stateCheckTimer.Interval = 25;
            stateCheckTimer.Tick    += new EventHandler(stateCheckTimer_Tick);

            addToLog("Application started...");

#if !DEBUG
            tabControl1.TabPages.RemoveByKey("tabPageLog");
#else
            //browser.Navigate( Util.GetDefaultURL() );
#endif
        }
        public async Task StateChangedEventHandler()
        {
            var    count = 0;
            object eventSender = null, eventArgs = null;

            var handler = new StateChangedEventHandler((sender, args) =>
            {
                eventSender = sender;
                eventArgs   = args;
                count++;
                return(new ValueTask());
            });

            var client = Mock.Of <IHazelcastClient>();
            var args   = new StateChangedEventArgs(ClientState.Connected);
            await handler.HandleAsync(client, args);

            Assert.That(count, Is.EqualTo(1));
            Assert.That(eventSender, Is.SameAs(client));
            Assert.That(eventArgs, Is.SameAs(args));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (task == null)
            {
                return;
            }

            timeLoggingController = TimeLoggingController.GetInstance();
            stateHandler          = new StateChangedEventHandler(timeLoggingStateChanged);

            if (NavigationController.NavigationBar.TopItem.Title.Equals("Process Dashboard"))
            {
                NavigationController.NavigationBar.TopItem.Title = "Back";
            }

            TdPlayBtn.TouchUpInside  += PlayBtnOnClick;
            TdPauseBtn.TouchUpInside += PauseBtnOnClick;
            refreshControlButtons();

            TdCheckboxBtn.TouchUpInside += delegate
            {
                ((TaskDetailTableSource)PlanTable.Source).completeDateText.BecomeFirstResponder();
            };

            tdProjectNameBtn.SetTitle(task.Project != null ? task.Project.Name : "", UIControlState.Normal);
            tdProjectNameBtn.SetTitleColor(UIColor.Black, UIControlState.Normal);
            TdTaskNameLb.Text = task.FullName ?? "";

            TdNotesTf.Layer.BorderColor  = UIColor.LightGray.CGColor;
            TdNotesTf.Layer.BorderWidth  = 2.0f;
            TdNotesTf.Layer.CornerRadius = 10.0f;
            TdNotesTf.Text = task.Note ?? "";

            PlanTable.Source = new TaskDetailTableSource(task, this);
            View.AddSubview(PlanTable);
        }
Exemple #16
0
        private void TimerTick(object state)
        {
            TimeSpan pulse = _sensor.Ping();

            float distance = HCSR04.ToCentimeters(pulse);

            if (distance.Equals(Single.MaxValue))
            {
                return;
            }

            bool newState = distance <= Barier;

            if (_collision ^ newState)
            {
                _collision = newState;
                StateChangedEventHandler handler = StateChanged;
                if (handler != null)
                {
                    StateChanged(_collision);
                }
            }
        }
Exemple #17
0
        /// <summary>
        /// Raises the state change event.
        /// </summary>
        /// <param name="newState">New state the machine has switched to.</param>
        /// <param name="previousState">Previous state the machine has switched from.</param>
        private void RaiseOnStateChangedEvent(State newState, State previousState)
        {
            StateChangedEventHandler handler = OnStateChanged;

            handler?.Invoke(this, new StateChangeEventArgs(newState, previousState));
        }
Exemple #18
0
        /// <summary>
        /// Initialises the IRC system
        /// </summary>
        /// <param name="settings">The settings to use while running the IRC tool</param>
        public static void Init()
        {
            JtvSettings Settings = desBot.State.JtvSettings.Value;
            if (Settings == null) throw new Exception("No settings specified");
            if (string.IsNullOrEmpty(Settings.Channel)) throw new Exception("No channel specified");
            if (string.IsNullOrEmpty(Settings.Nickname)) throw new Exception("No JTV username specified");
            if (string.IsNullOrEmpty(Settings.Password)) throw new Exception("No JTV password specified");

            //disconnect
            if (client != null && client.IsConnected) client.Disconnect();
            client = null;

            //kill restart timer
            autorestart = null;
            detecthang = null;

            //initial values
            state = IrcState.None;
            Program.Log("IRC initialising");

            //attach event handler to send delay
            desBot.State.SendDelay.OnChanged += new OnPropertyValueChanged<int, int>(sendDelay_Changed);

            //set up state
            State = IrcState.None;
            Settings.Channel = Settings.Channel.ToLower(); //lower case to prevent mismatchign of string casings
            client = new IrcClient();

            //text encoding
            Encoding encoding = null;
            try
            {
                //try UTF8-encoding
                encoding = new System.Text.UTF8Encoding(false, false);
            }
            catch(Exception)
            {
                try
                {
                    //try codepage 1252 first (western european ANSI)
                    encoding = System.Text.Encoding.GetEncoding(1252);
                }
                catch (Exception)
                {
                    //fallback to ASCII encoding
                    encoding = new System.Text.ASCIIEncoding();
                }
            }
            client.Encoding = encoding;
            Program.Log("Using IRC text encoding codepage: " + encoding.CodePage.ToString());

            //set up config
            client.SendDelay = desBot.State.SendDelay.Value;
            client.AutoNickHandling = false;

            //set up event handlers
            client.OnConnectionError += new EventHandler(client_OnConnectionError);
            client.OnConnecting += new System.EventHandler(client_OnConnecting);
            client.OnConnected += new System.EventHandler(client_OnConnected);
            client.OnRegistered += new System.EventHandler(client_OnRegistered);
            client.OnDisconnecting += new System.EventHandler(client_OnDisconnecting);
            client.OnDisconnected += new System.EventHandler(client_OnDisconnected);
            client.OnOp += new OpEventHandler(client_OnOp);
            client.OnDeop += new DeopEventHandler(client_OnDeop);
            client.OnNames += new NamesEventHandler(client_OnNames);
            client.OnJoin += new JoinEventHandler(client_OnJoin);
            client.OnPart += new PartEventHandler(client_OnPart);
            client.OnQueryMessage += new IrcEventHandler(client_OnQueryMessage);
            client.OnQueryNotice += new IrcEventHandler(client_OnQueryNotice);
            client.OnChannelMessage += new IrcEventHandler(client_OnChannelMessage);
            client.OnRawMessage += new IrcEventHandler(client_OnRawMessage);

            //set up auto-reconnect
            OnStateChanged += new StateChangedEventHandler(Irc_OnStateChanged);

            //set up hang detection timer
            lastcheck = IrcState.Connecting;
            detecthang = new Timer(new TimerCallback(DetectHang), null, 60000, 60000);

            //reset bansystem
            BanSystem.Reset();

            //spawn dedicated thread
            new Thread(new ThreadStart(client_Listen)).Start();
        }
Exemple #19
0
 private void RaiseHandlerState(HandlerState state)
 {
     StateChangedEventHandler?.Invoke(this, new AssociationStateChangedEventArgs(state));
 }