示例#1
0
        protected override async Task AutoExecAsync()
        {
            try
            {
                base.AutoExec();
                VersioInfo = VerHelper.CurVerStr(".Net5");

                using (var db = A0DbMdl.GetA0DbMdlAzureDb)
                {
                    await LoadFromDbAsync(db);

                    SelectSnRt = null;

                    //sessionLoad_Start_lazy();
                    IsInSsn = true;
                    IsAdmin = VerHelper.IsVIP;

                    //var gnd = (VoiceGender)((AppRunCount++) % 3 + 1);
                    synth.Rate = 3;
                    //Feb 2020: seems to hang on this one: synth.SelectVoiceByHints(gnd, VoiceAge.Senior);

                    _dt = new DispatcherTimer(TimeSpan.FromMilliseconds(_t333ms), DispatcherPriority.Background, new EventHandler(async(s, e) => await tick333ms()), Dispatcher.CurrentDispatcher); //tu: one-line timer
                    _dt.Start();
                    MainVis = Visibility.Visible;
                    Opcty   = 1;
                    //SpeedClr = new SolidColorBrush(Colors.White);
                    await updateDoneTodo(SelectUser, synth, db);
                }

                CurInfo = $"{(LesnTyp)} - {SubLesnId:N0}  ";// ({DashName})";
            }
            catch (Exception ex) { ex.Log(); synth.SpeakAsyncCancelAll(); synth.SpeakFaF($"Something is not right: {ex.Message}. Talk to you later"); }

            Trace.TraceInformation($"{DateTime.Now:HH:mm:ss.fff} AutoExec: \t.");
        }
        async Task reload()
        {
            _db         = A0DbContext.Create();
            tbComp.Text = VerHelper.CurVerStr(A0DbContext.SolutionCfg);

            try
            {
                await _db.TxMoneySrcs.LoadAsync();

                await _db.BalAmtHists.LoadAsync();

                await _db.TxCoreV2.LoadAsync(); //full history is here: await _db.Vw_TxCore.LoadAsync(); - is it worth it/useful

                var groupByMnySrc = _db.TxCoreV2.Local.GroupBy(c => new { c.TxMoneySrcId }).Select(g => new { g.Key.TxMoneySrcId, Count = g.Count(), LastTx = g.Max(r => r.TxDate) }).ToList();

                //var usedMnySrcList = _db.TxCoreV2.Local.Select(r => r.TxMoneySrcId).Distinct().ToList();        //lbMnySrc_Flas.ItemsSource = _db.TxMoneySrcs.Local.Where(r => usedMnySrcList.Contains(r.Id)).OrderBy(r => r.Fla);
                lbMnySrc_Flas.ItemsSource = _db.TxMoneySrcs.Local.
                                            Join(groupByMnySrc, s => s.Id, c => c.TxMoneySrcId, (s, c) => new { s, c }).
                                            Select(r => new Tms(r.s.Id, r.s.Fla, r.s.Name,
                                                                r.s.IniBalance,
                                                                r.c.LastTx,
                                                                $"{r.s.Notes}\r\nCount: \t {r.c.Count}\r\nLast: \t {r.c.LastTx:yyy-MM-dd}"
                                                                ));

                lbMnySrc_Flas.Focus();
            }
            catch (Exception ex) { ex.Log(); }
        }
示例#3
0
        public MainWindow() : base()
        {
            InitializeComponent();

            _ignoreEscape = true;

            VersioInfo.Text = $"{VerHelper.CurVerStr(".NET 4.8")}\n{DbMdl.A0DbMdl.GetA0DbMdlAzureDb.ServerDatabase()}";
        }
示例#4
0
        public PodCatcherViewModel(bool countDown = true)
        {
            Bpr.Beep1of2();

            CurVer = VerHelper.CurVerStr(A0DbContext.SqlEnv); //bool isDay0; if (bool.TryParse(MiscDataHelper.GetSetting("daq", "IsDay0", "True", "Directive flag to run all tasks in Full or Daily/Delta mode.").SValue, out isDay0))IsDay0 = isDay0;

            IsAutoNextStep = countDown;

            Task.Run(() => Thread.Sleep(1))
            .ContinueWith(async _ => await reLoad(), TaskScheduler.FromCurrentSynchronizationContext())
            .ContinueWith(_ =>
            {
#if !SkipCountDown
                if (IsAutoNextStep)
                {
                    Bpr.BeepOkB();
                }
                Thread.Sleep(1000);
                if (IsAutoNextStep)
                {
                    Bpr.BeepFD(9000, 200);
                }
                Thread.Sleep(1000);
                if (IsAutoNextStep)
                {
                    Bpr.BeepFD(8600, 200);
                }
                Thread.Sleep(1000);
                if (IsAutoNextStep)
                {
                    Bpr.BeepFD(8300, 200);
                }
                Thread.Sleep(1000);
                if (IsAutoNextStep)
                {
                    Bpr.BeepFD(8000, 600);
                }
                Thread.Sleep(1000);
                if (IsAutoNextStep)
                {
                    Bpr.BeepFD(7000, 200);
                }
                Thread.Sleep(5);
                if (IsAutoNextStep)
                {
                    Bpr.BeepFD(7000, 200);
                }
#endif
            })
            .ContinueWith(_ => { if (IsAutoNextStep)
                                 {
                                     onDoAll(null);
                                 }
                          }, TaskScheduler.FromCurrentSynchronizationContext())
            .ContinueWith(_ => Bpr.Beep2of2(), TaskScheduler.FromCurrentSynchronizationContext());
        }
示例#5
0
        public MainWindow() : base()
        {
            InitializeComponent();

            _ignoreEscape = true;

            VersioInfo.Text = $"{VerHelper.CurVerStr(".Net5")}\n{DbMdl.A0DbMdl.GetA0DbMdlAzureDb.ServerDatabase()}";

            Topmost = Debugger.IsAttached;
        }
示例#6
0
        //SpeechSynthesizer synth = new SpeechSynthesizer();

        public DdjViewModel()
        {
            _timer.Tick += onTick;
            _timer.Start();
            TopRightTiny = $"   {VerHelper.CurVerStr("4.8")} ";
            //UserA = DevOp.IsVIP;
            UserM = Environment.UserName.ToLower().Contains("mei");
            UserN = Environment.UserName.ToLower().Contains("nadi");
            UserZ = Environment.UserName.ToLower().Contains("zoe");


            _TrgFolders = new ObservableCollection <string>(new[] { @"M:\", @"C:\Users\nadin\OneDrive\Music\dm\", $@"C:\1\M\" });

            //RegisterHotKey(this.Handle, 4540, 0, Keys.MediaPlayPause);
        }
示例#7
0
        //public static readonly DependencyProperty ZVProperty = DependencyProperty.Register("ZV", typeof(double), typeof(RODBView), new PropertyMetadata(1d)); public double ZV { get { return (double)GetValue(ZVProperty); } set { SetValue(ZVProperty, value); } }

        async void onLoaded(object s, RoutedEventArgs e)
        {
            ZommablePanel.IsEnabled = false;
            try
            {
                tbInfo.Text   = $"Loading ... {_localdb}";
                tbCurVer.Text = $"{VerHelper.CurVerStr(".NET 5.0")}";

                await _db.PcLogics.LoadAsync();

                await _db.EvOfInts.OrderByDescending(r => r.TimeID).LoadAsync(); //tu: error "'EditItem' is not allowed for this view." if Order is done on Local !!!!!!!!!!!!!!

                ((CollectionViewSource)(this.FindResource("pcLogicViewSource"))).Source         = _db.PcLogics.Local;
                ((CollectionViewSource)(this.FindResource("pcLogicEvOfIntsViewSource"))).Source = _db.EvOfInts.Local;
                ((CollectionViewSource)(this.FindResource("pcLogicEvOfIntsViewSourRO"))).Source = _db.EvOfInts.Local;

                tbInfo.Text = $"{_db.PcLogics.Local.Count} PCs, {_db.EvOfInts.Local.Count} events in \r\n{_localdb}.";
            }
            catch (Exception ex) { ex.Pop();; }
            finally { ZommablePanel.IsEnabled = true; }
        }
        async void onLoaded(object s, RoutedEventArgs e)
        {
            vizroot.IsEnabled = false;
            try
            {
                tbInfo.Text   = $"Loading ...  ";
                tbCurVer.Text = $"{VerHelper.CurVerStr(".NET 5.0")}";

                var itemsSrc = await DbLogHelper.AllPCsAsync();

                tbInfo.Text = $"Loading {itemsSrc.Count} PCs...  ";

                var _localdb = OneDrive.Folder($@"{DbLogHelper._dbSubP}LocalDb({Environment.MachineName}).mdf");
                FileAttributeHelper.RmvAttribute(_localdb, FileAttributes.ReadOnly);
                var _db = A0DbModel.GetLclFl(_localdb);
                await _db.PcLogics.LoadAsync();

                await _db.EvOfInts.LoadAsync();

                //foreach (PcLogic item in ((List<PcLogic>)pcLogicDataGridRO.ItemsSource).Where(r => !r.MachineName.Equals(Environment.MachineName, StringComparison.OrdinalIgnoreCase)))                    _db.PcLogics.Local.Add(item);

                ((CollectionViewSource)(FindResource("pcLogicViewSource"))).Source = _db.PcLogics.Local;
                ((CollectionViewSource)(FindResource("evOfIntViewSource"))).Source = _db.EvOfInts.Local;

                tbInfo.Text = $"{_db.PcLogics.Local.Count} PCs with {_db.EvOfInts.Local.Count} events.";

                pcLogicDataGridRO.ItemsSource = itemsSrc;
                foreach (var item in itemsSrc)
                {
                    if (item.MachineName.Equals(Environment.MachineName, StringComparison.OrdinalIgnoreCase))
                    {
                        pcLogicDataGridRO.SelectedItem = item;
                    }
                }
                pcLogicDataGridRO.Focus();
            }
            catch (Exception ex) { ex.Pop();; }
            finally { vizroot.IsEnabled = true; }
        }
        public MainAppDispatcher()
        {
            InitializeComponent();

            KeyUp += (s, e) =>
            {
                switch (e.Key)
                {
                case Key.Escape: Close(); App.Current.Shutdown(); break;

                case Key.Up: /**/ Settings.Default.LastBtnNo = Settings.Default.LastBtnNo > 0 /**/ ? --Settings.Default.LastBtnNo : 0; /**/ setDefault(Settings.Default.LastBtnNo); break;

                case Key.Down: /**/ Settings.Default.LastBtnNo = Settings.Default.LastBtnNo < _zeroBasedBtnCnt /**/ ? ++Settings.Default.LastBtnNo : _zeroBasedBtnCnt; /**/ setDefault(Settings.Default.LastBtnNo); break;

                default: break;
                }
            }; //tu:

            //Task.Run(async () => await A0DbContext.Create().UnitPrices.LoadAsync()); // preload to ini the EF for faster loads in views.

            setDefault(Settings.Default.LastBtnNo);
            tbver.Text = $"db:{Db.FinDemo.DbModel.A0DbContext.DbName}    -   {VerHelper.CurVerStr(".NET 4.8")}";
        }
        public void ShowOnTargetScreen(Screen trgScreen, bool showMaximized)
        {
            //Task.Run(async () => await Task.Delay(waitMs)).ContinueWith(_ =>  {
            Show();
            Left  = trgScreen.Bounds.Left;
            Top   = trgScreen.Bounds.Top;
            Title = $" {string.Join(" ", Environment.GetCommandLineArgs())} \t\t {trgScreen.DeviceName} - {(trgScreen.Primary ? "Primary  " : "Secondary")}   XY: {trgScreen.Bounds.X,5} x {trgScreen.Bounds.Y,-5} \t\t {(VerHelper.IsVIP ? "VIP  :)" : "!vip   :(")}      {VerHelper.CurVerStr(".Net 5.0")}"; // always NaN / 0: ► Left-Top: {(double.IsNaN(window.Left) ? -1.0 : window.Left)}-{(double.IsNaN(window.Top) ? -1.0 : window.Top)}   Actual W x H: {window.ActualWidth}x{window.ActualHeight}" +

            if (showMaximized)
            {
                WindowState = WindowState.Maximized;
            }
            else
            {
                WindowState = WindowState.Normal;
                Width       = trgScreen.Bounds.Width;
                Height      = 50;                //  trgScreen.Bounds.Height / 32;
                //Background = Brushes.DarkSlateGray;
                Top = trgScreen.Bounds.Top + 40; // task bar considerations.
                //Opacity = .75;
            }

            //}, TaskScheduler.FromCurrentSynchronizationContext());

            Debug.WriteLine($"  {Title.Replace("\r", " ").Replace("\n", " ")}");
        }