public ProcessWatcher(MPC api) {
     this.api = api;
     this.AllowClose = true;
     timerKillIfFrozen = new Timer(2000);
     timerKillIfFrozen.Elapsed += timerKillIfFrozen_Elapsed;
     // timerKillIfFrozen.Start();
 }
Example #2
0
    void HealPlayer()
    {
        if (MPC == null)
        {
            MPC = GameObject.Find("MainPlayer").GetComponent <MainPlayer>();
        }
        HealingBuff HB = HealingBuff.Generate(MPC.GetMaxStats(STATSTYPE.HEALTH) * 0.1f, 5f);

        HB.ApplyBuff(null, MPC);
    }
        private void latlng_Click(object sender, EventArgs e)
        {
            MapPoint.Map objMap = null;
            objMap = MPC.NewMap(MapPoint.GeoMapRegion.geoMapEurope);
            object obj1 = 1;

            objMap.ActiveRoute.Waypoints.Add(objMap.FindResults(FromTextBox.Text).get_Item(ref obj1), "");
            objMap.ActiveRoute.Waypoints.Add(objMap.FindResults(ToTextBox.Text).get_Item(ref obj1), "");
            objMap.ActiveRoute.Calculate();
            distance.Text = (objMap.ActiveRoute.Distance) * 3600 / 10000 + "  meters";
        }
Example #4
0
        public MainWindow(MPC mpc)
        {
            InitializeComponent();

            this.mpc = mpc;

            panelRawCommand1.MPC = mpc;

            notifyIcon1.Text = this.Text;

            playlistView.DataSource = mpc.CurrentPlaylist;

            FormClosing += new FormClosingEventHandler(Form1_FormClosing);
        }
Example #5
0
        public ConnectViewModel()
        {
            Title = "Connect to MPD";

            App me = App.Current as App;

            _con = me.MpdConection;
            _mpc = _con.Mpc;

            ConnectCommand = new Command(OnConnectClicked, Connect_CanExecute);


            _mpc.Connected += new MPC.MpdConnected(OnConnected);
        }
Example #6
0
        private void OnConnected(MPC sender)
        {
            Debug.WriteLine("OnConnected@SettingViewModel");

            IsBusy = false;

            SettingProfileEditMessage = "Connected!";

            Device.BeginInvokeOnMainThread(
                () =>
            {
                GoToPage?.Invoke(this, "HomePage");
            });

            SettingProfileEditMessage = "";
        }
        /// <summary>
        /// When playing new file, update CurrentVideo.Length and raise NowPlaying event.
        /// </summary>
        /// <param name="msg"></param>
        private void Player_MPC_NowPlaying(MPC.MSGIN msg) {
            timerGetPosition.Start();

            string[] FileInfo = msg.Message.Split('|');
            CurrentVideo.Length = (short)double.Parse(FileInfo[4], CultureInfo.InvariantCulture);

            // In later version of MPC-HC, this event keeps firing repeatedly, so ignore when file path is the same.
            if (!string.IsNullOrEmpty(FileInfo[3]) && nowPlayingPath != FileInfo[3]) {
                nowPlayingPath = FileInfo[3];
                position = 0;
                timerPlayTimeout.Stop();

                if (NowPlaying != null)
                    NowPlaying(this, new EventArgs());

                TimerGetPositionEnabled = true;
            }
        }
Example #8
0
        public SettingViewModel()
        {
            Title = "Profile";

            App me = App.Current as App;

            _con = me.MpdConection;
            _mpc = _con.Mpc;

            _mpc.IsBusy += new MPC.MpdIsBusy(OnClientIsBusy);

            SaveOrUpdateProfileCommand = new Command(SaveOrUpdateProfile);
            AddNewProfileCommand       = new Command(AddNewProfile);
            DeleteProfileCommand       = new Command(DeleteProfile);

            if (_con.CurrentProfile != null)
            {
                SelectedProfile = _con.CurrentProfile;
            }

            _mpc.Connected += new MPC.MpdConnected(OnConnected);
        }
Example #9
0
        public Program()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            timer          = new Timer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = 100;

            m_KeyboardListener          = new KeyboardListener(Keys.MediaPlayPause, Keys.MediaStop, Keys.MediaPreviousTrack, Keys.MediaNextTrack);
            m_KeyboardListener.KeyDown += m_KeyboardListener_KeyDown;

            mpc = new MPC(Properties.Settings.Default.Server1);

            lcd = new LCD("MPCdotNet", false);
            lcd.SetPlaybackState(PlaybackState.Stopped);
            lcd.Artist      = "";
            lcd.Title       = "";
            lcd.Album       = "";
            lcd.TrackTime   = 0;
            lcd.TrackLength = 0;

            window = new MainWindow(mpc);
            mpc.OnConnectionStateChanged += window.mpc_onConnectionStateChange;


            if (Properties.Settings.Default.AutoConnect)
            {
                mpc.Open();
            }
            timer.Start();

            Application.Run(window);

            mpc.Close();
        }
Example #10
0
 private void OnClientIsBusy(MPC sender, bool on)
 {
     IsBusy = on;
 }
 /// <summary>
 /// Raise the Pause event.
 /// </summary>
 private void player_MPC_Stop(MPC.MSGIN msg) {
     isPlaying = false;
     if (Pause != null)
         Pause(this, new EventArgs());
 }
 /// <summary>
 /// Raise the Resume event.
 /// </summary>
 private void player_MPC_Play(MPC.MSGIN msg) {
     isPlaying = true;
     if (Resume != null)
         Resume(this, new EventArgs());
 }
 /// <summary>
 /// Raise PositionChanged event.
 /// </summary>
 private void Player_MPC_CurrentPosition(MPC.MSGIN msg) {
     if (TimerGetPositionEnabled) {
         double PositionValue = 0;
         if (Double.TryParse(msg.Message, NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out PositionValue)) {
             position = PositionValue;
             if (PositionChanged != null)
                 PositionChanged(this, new EventArgs());
         }
     }
 }
 /// <summary>
 /// Raise PositionChanged event.
 /// </summary>
 private void Player_MPC_CurrentPosition(MPC.MSGIN msg) {
     if (TimerGetPositionEnabled) {
         position = Convert.ToDouble(msg.Message, System.Globalization.CultureInfo.InvariantCulture);
         if (PositionChanged != null)
             PositionChanged(this, new EventArgs());
     }
 }
Example #15
0
        public IQueryable <TEntity> ApplyFilter <TEntity>(IQueryable <TEntity> query) where TEntity : MessageEntity
        {
            if (!String.IsNullOrEmpty(EbmsMessageId))
            {
                string filter = EbmsMessageId.Replace("*", "");
                if (EbmsMessageId.StartsWith("*") && EbmsMessageId.EndsWith("*"))
                {
                    query = query.Where(qr => qr.EbmsMessageId.Contains(filter));
                }
                else if (EbmsMessageId.EndsWith("*"))
                {
                    query = query.Where(qr => qr.EbmsMessageId.StartsWith(filter));
                }
                else if (EbmsMessageId.StartsWith("*"))
                {
                    query = query.Where(qr => qr.EbmsMessageId.EndsWith(filter));
                }
                else
                {
                    query = query.Where(qr => qr.EbmsMessageId == filter);
                }
            }

            if (!String.IsNullOrEmpty(EbmsRefToMessageId))
            {
                string filter = EbmsRefToMessageId.Replace("*", "");
                if (EbmsRefToMessageId.StartsWith("*") && EbmsRefToMessageId.EndsWith("*"))
                {
                    query = query.Where(qr => qr.EbmsRefToMessageId.Contains(filter));
                }
                else if (EbmsRefToMessageId.EndsWith("*"))
                {
                    query = query.Where(qr => qr.EbmsRefToMessageId.StartsWith(filter));
                }
                else if (EbmsRefToMessageId.StartsWith("*"))
                {
                    query = query.Where(qr => qr.EbmsRefToMessageId.EndsWith(filter));
                }
                else
                {
                    query = query.Where(qr => qr.EbmsRefToMessageId == filter);
                }
            }

            if (Operation != null)
            {
                IEnumerable <string> operations = Operation.Select(op => op);
                query = query.Where(qr => operations.Contains(qr.Operation.ToString()));
            }

            switch (InsertionTimeType)
            {
            case DateTimeFilterType.Custom:
                if (InsertionTimeFrom != null && InsertionTimeTo != null)
                {
                    query = query.Where(qr => qr.InsertionTime >= InsertionTimeFrom &&
                                        qr.InsertionTime <= InsertionTimeTo);
                }
                else if (InsertionTimeFrom == null && InsertionTimeTo != null)
                {
                    query = query.Where(qr => qr.InsertionTime <= InsertionTimeTo);
                }
                else if (InsertionTimeFrom != null && InsertionTimeTo == null)
                {
                    query = query.Where(qr => qr.InsertionTime >= InsertionTimeFrom);
                }

                break;

            case DateTimeFilterType.Last4Hours:
                DateTime last4Hours = DateTime.UtcNow.AddHours(-4);
                query = query.Where(x => x.InsertionTime >= last4Hours);
                break;

            case DateTimeFilterType.LastDay:
                DateTime lastDay = DateTime.UtcNow.AddDays(-1);
                query = query.Where(x => x.InsertionTime >= lastDay);
                break;

            case DateTimeFilterType.LastHour:
                DateTime lastHour = DateTime.UtcNow.AddHours(-1);
                query = query.Where(x => x.InsertionTime >= lastHour);
                break;

            case DateTimeFilterType.LastMonth:
                DateTime lastMonth = DateTime.UtcNow.AddMonths(-1);
                query = query.Where(x => x.InsertionTime >= lastMonth);
                break;

            case DateTimeFilterType.LastWeek:
                DateTime lastWeek = DateTime.UtcNow.AddDays(-7);
                query = query.Where(x => x.InsertionTime >= lastWeek);
                break;

            case DateTimeFilterType.Ignore:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (ModificationTimeFrom != null && ModificationTimeTo == null)
            {
                query = query.Where(qr => qr.ModificationTime >= ModificationTimeFrom);
            }
            else if (ModificationTimeFrom == null && ModificationTimeTo != null)
            {
                query = query.Where(qr => qr.ModificationTime <= ModificationTimeTo);
            }
            else if (ModificationTimeFrom != null && ModificationTimeTo != null)
            {
                query = query.Where(qr => qr.ModificationTime >= ModificationTimeFrom &&
                                    qr.ModificationTime <= ModificationTimeTo);
            }

            if (MEP != null)
            {
                query = query.Where(qr => MEP.Contains(qr.MEP));
            }

            if (EbmsMessageType != null)
            {
                query = query.Where(qr => EbmsMessageType.Contains(qr.EbmsMessageType));
            }

            if (ContentType != null)
            {
                List <string> types = ContentType.Select(x => x == "mime" ? "multipart/related" : "application/soap+xml")
                                      .ToList();
                query = query.Where(qr => types.Any(data => qr.ContentType.StartsWith(data)));
            }

            if (Status != null && Status.Any())
            {
                List <string> statusStrings = Status.Select(status => status.ToString()).ToList();
                query = query.Where(qr => statusStrings.Contains(qr.Status));
            }

            if (!String.IsNullOrEmpty(FromParty))
            {
                query = query.Where(x => x.FromParty == FromParty);
            }

            if (!String.IsNullOrEmpty(ToParty))
            {
                query = query.Where(x => x.ToParty == ToParty);
            }

            if (!ShowDuplicates)
            {
                query = query.Where(x => !x.IsDuplicate);
            }

            if (!ShowTests)
            {
                query = query.Where(x => !x.IsTest);
            }

            if (!String.IsNullOrEmpty(ActionName))
            {
                string filter = ActionName.Replace("*", "");
                if (ActionName.StartsWith("*") && ActionName.EndsWith("*"))
                {
                    query = query.Where(qr => qr.Action.Contains(filter));
                }
                else if (ActionName.EndsWith("*"))
                {
                    query = query.Where(qr => qr.Action.StartsWith(filter));
                }
                else if (ActionName.StartsWith("*"))
                {
                    query = query.Where(qr => qr.Action.EndsWith(filter));
                }
                else
                {
                    query = query.Where(qr => qr.Action == filter);
                }
            }

            if (!String.IsNullOrEmpty(Service))
            {
                string filter = Service.Replace("*", "");
                if (Service.StartsWith("*") && Service.EndsWith("*"))
                {
                    query = query.Where(qr => qr.Service.Contains(filter));
                }
                else if (Service.EndsWith("*"))
                {
                    query = query.Where(qr => qr.Service.StartsWith(filter));
                }
                else if (Service.StartsWith("*"))
                {
                    query = query.Where(qr => qr.Service.EndsWith(filter));
                }
                else
                {
                    query = query.Where(qr => qr.Service == filter);
                }
            }

            if (!String.IsNullOrEmpty(MPC))
            {
                string filter = MPC.Replace("*", "");
                if (MPC.StartsWith("*") && MPC.EndsWith("*"))
                {
                    query = query.Where(qr => qr.Mpc.Contains(filter));
                }
                else if (MPC.EndsWith("*"))
                {
                    query = query.Where(qr => qr.Mpc.StartsWith(filter));
                }
                else if (MPC.StartsWith("*"))
                {
                    query = query.Where(qr => qr.Mpc.EndsWith(filter));
                }
                else
                {
                    query = query.Where(qr => qr.Mpc == filter);
                }
            }

            if (Pmode != null && Pmode.Length > 0)
            {
                query = query.Where(qr => Pmode.Contains(qr.PModeId));
            }

            return(query);
        }