Esempio n. 1
0
 public TestMouseHook(MonitorHookFactory mhf)
 {
     InitializeComponent();
     _mhf  = mhf;
     _hook = _mhf.GetMouseObserver();
     _hook.Start();
     _hook.OnMouseInput += UpDate;
     _upd = ToList;
     ShowDialog();
 }
 public TestPrintHook(MonitorHookFactory mhf)
 {
     InitializeComponent();
     _mhf  = mhf;
     _upd  = ToList;
     _hook = _mhf.GetPrintObserver();
     _hook.Start();
     _hook.OnPrintEvent += UpDate;
     ShowDialog();
 }
 public TestAppHook(MonitorHookFactory mhf)
 {
     InitializeComponent();
     _mhf  = mhf;
     _upd  = ToList;
     _hook = _mhf.GetApplicationObserver();
     _hook.Start();
     _hook.OnAppWindowChange += UpDate;
     ShowDialog();
 }
 public TestKeyBoardHook(MonitorHookFactory mhf)
 {
     InitializeComponent();
     _mhf  = mhf;
     _upd  = ToList;
     _hook = _mhf.GetKeyboardObserver();
     _hook.Start();
     _hook.OnKeyInput += UpDate;
     ShowDialog();
 }
 public TestClipBordHook(MonitorHookFactory mhf)
 {
     InitializeComponent();
     _mhf  = mhf;
     _upd  = ToList;
     _hook = _mhf.GetClipboardObserver();
     _hook.Start();
     _hook.OnClipboardModified += UpDate;
     ShowDialog();
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = UPD.GetHashCode();
         hashCode = (hashCode * 397) ^ Multiplier.GetHashCode();
         hashCode = (hashCode * 397) ^ Credit.GetHashCode();
         hashCode = (hashCode * 397) ^ PPD.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 7
0
        static public int ReadPort(int port)
        {
            if ((port & 0x0480) == 0)
            {
                return(UPD.Read(port));
            }

            if ((port & 0x0800) == 0)
            {
                return(PPI.Read(port));
            }

            if ((port & 0x4000) == 0)
            {
                return(CRTC.Read(port));
            }

            return(0xFF);
        }
Esempio n. 8
0
        private async Task <bool> InitTANMedium(FinTsClient client)
        {
            // TAN-Medium-Name
            var accounts = await client.Accounts(CreateTANDialog(client));

            if (!accounts.IsSuccess)
            {
                HBCIOutput(accounts.Messages);
                return(false);
            }
            var conn = client.ConnectionDetails;
            AccountInformation accountInfo = UPD.GetAccountInformations(conn.Account, conn.Blz.ToString());

            if (accountInfo != null && accountInfo.IsSegmentPermitted("HKTAB"))
            {
                client.HITAB = txt_tan_medium.Text;
            }

            return(true);
        }
Esempio n. 9
0
        /// <summary>
        /// Update the list of apps by doing minimal changes to avoid losing focus.
        /// Adding what is not yet there and deleting what has disappeared.
        /// </summary>
        void refreshAppList_smart()
        {
            DataGridViewRow selected = null;

            var plan = _currentPlan;

            var planAppDefsDict = (plan != null) ? (from ad in plan.AppDefs select ad).ToDictionary(ad => ad.Id, ad => ad) : new Dictionary <AppIdTuple, AppDef>();
            var planAppIdTuples = (plan != null) ? (from ad in plan.AppDefs select ad.Id).ToList() : new List <AppIdTuple>();

            Dictionary <AppIdTuple, AppState> appStates;

            if (ShowJustAppFromCurrentPlan)
            {
                appStates = (from i in _ctrl.GetAllAppStates() where planAppIdTuples.Contains(i.Key) select i).ToDictionary(mc => mc.Key, mc => mc.Value);
            }
            else             // show from all plans
            {
                appStates = new Dictionary <AppIdTuple, AppState>(_ctrl.GetAllAppStates());
            }

            // remember apps from plan
            Dictionary <string, AppIdTuple> newApps = new Dictionary <string, AppIdTuple>();

            foreach (AppIdTuple a in appStates.Keys)
            {
                newApps[a.ToString()] = a;
            }

            // remember apps from list
            Dictionary <string, DataGridViewRow> oldApps = new Dictionary <string, DataGridViewRow>();

            foreach (DataGridViewRow item in gridApps.Rows)
            {
                string id = item.Cells[appTabColName].Value as string;
                oldApps[id] = item;

                if (item.Selected)
                {
                    if (selected == null)
                    {
                        selected = item;
                    }
                }
            }

            // determine what to add and what to remove
            List <DataGridViewRow> toRemove = new List <DataGridViewRow>();
            List <object[]>        toAdd    = new List <object[]>();

            foreach (DataGridViewRow item in gridApps.Rows)
            {
                string id = item.Cells[0].Value as string;
                if (!newApps.ContainsKey(id))
                {
                    toRemove.Add(item);
                }
            }

            foreach (var x in appStates)
            {
                var idStr = x.Key.ToString();
                if (!oldApps.ContainsKey(idStr))
                {
                    var id       = x.Key;
                    var appState = x.Value;
                    var item     = new object[appTabNumCols];
                    item[appTabColName] = idStr;
                    //item[appTabColStatus] = getAppStatusCode( id, appState, planAppIdTuples.Contains( id ) );
                    item[appTabColStatus]      = Tools.GetAppStateText(appState, _ctrl.GetPlanState(appState.PlanName), _ctrl.GetAppDef(id));
                    item[appTabColIconStart]   = ResizeImage(new Bitmap(Resource1.play), new Size(20, 20));
                    item[appTabColIconKill]    = ResizeImage(new Bitmap(Resource1.delete), new Size(20, 20));
                    item[appTabColIconRestart] = ResizeImage(new Bitmap(Resource1.refresh), new Size(20, 20));
                    item[appTabColEnabled]     = false;
                    item[appTabColPlan]        = GetPlanForApp(id);
                    toAdd.Add(item);
                }
            }

            foreach (var i in toRemove)
            {
                gridApps.Rows.Remove(i);
            }

            foreach (var i in toAdd)
            {
                gridApps.Rows.Add(i);
            }

            Dictionary <DataGridViewRow, UPD> toUpdate = new Dictionary <DataGridViewRow, UPD>();

            foreach (var o in oldApps)
            {
                if (!toRemove.Contains(o.Value))
                {
                    var id       = newApps[o.Key];
                    var appState = _ctrl.GetAppState(id);
                    var upd      = new UPD()
                    {
                        //Status = getAppStatusCode( id, appState, planAppIdTuples.Contains( id ) ),
                        Status   = Tools.GetAppStateText(appState, _ctrl.GetPlanState(appState.PlanName), _ctrl.GetAppDef(id)),
                        PlanName = null
                    };
                    if (appState.PlanName != null)
                    {
                        upd.PlanName = appState.PlanName;
                    }
                    toUpdate[o.Value] = upd;
                }
            }

            foreach (var tu in toUpdate)
            {
                var row = tu.Key;
                var upd = tu.Value;

                row.Cells[appTabColStatus].Value = upd.Status;

                if (upd.PlanName != null)
                {
                    row.Cells[appTabColPlan].Value = upd.PlanName;
                }
            }

            // colorize the background of items from current plan
            List <string> planAppIds = (from ad in planAppIdTuples select ad.ToString()).ToList();

            foreach (DataGridViewRow item in gridApps.Rows)
            {
                string idStr = item.Cells[0].Value as string;
                var    id    = AppIdTuple.fromString(idStr, "");

                if (planAppIds.Contains(idStr))
                {
                    item.DefaultCellStyle.BackColor = Color.LightGoldenrodYellow;
                }
                else
                {
                    item.DefaultCellStyle.BackColor = SystemColors.Control;
                }

                // set checkbox based on Enabled attribute od the appDef from current plan
                var appDef = planAppDefsDict.ContainsKey(id) ? planAppDefsDict[id] : null;
                {
                    var chkCell = item.Cells[appTabColEnabled] as DataGridViewCheckBoxCell;
                    chkCell.Value = appDef != null ? !appDef.Disabled : false;
                    // emulate "Disabled" grayed appearance
                    chkCell.FlatStyle       = appDef != null ? FlatStyle.Standard : FlatStyle.Flat;
                    chkCell.Style.ForeColor = appDef != null ? Color.Black : Color.DarkGray;
                    chkCell.ReadOnly        = appDef == null;
                }
                // put app state into a tooltip
                {
                    var appStatusCell = item.Cells[appTabColStatus];                     // as DataGridViewCell;
                    appStatusCell.ToolTipText = Tools.GetAppStateString(id, _ctrl.GetAppState(id));
                }
            }
        }
Esempio n. 10
0
 public bool Equals(ProteinProduction other) => UPD.Equals(other.UPD) && Multiplier.Equals(other.Multiplier) && Credit.Equals(other.Credit) && PPD.Equals(other.PPD);