Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            currentTimeClk.SetTime(DateTime.Now);
            theTicker            = new TimeTicker();
            theTicker.TickEvent += Tick;
            startTimeClk.SetTime(new DateTime()); //00:00:00
            startTimeClk.ClockModified += ClockModified;

            var file = System.AppDomain.CurrentDomain.BaseDirectory + "\\default.chg";

            if (File.Exists(file))
            {
                var ccf = ChargeCodeFile.ReadFile(file);
                Timers.Clear();
                chargeNumberStack.Children.Clear();
                CurrentTimer = null;
                foreach (var ccode in ccf.ChargeCode)
                {
                    var telement = new TimerElement(ccode.Code, ccode.Description);
                    Timers.Add(telement);
                    chargeNumberStack.Children.Add(telement);
                    telement.TimerActionPerformed += TimerActionCallback;
                }
            }
        }
Ejemplo n.º 2
0
        private void loadBtn_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Microsoft.Win32.OpenFileDialog
            {
                FileName   = "ChargeCodes",
                DefaultExt = "chg",
                Filter     = "Charge Codes (.chg)|*.chg"
            };

            if (ofd.ShowDialog() == true)
            {
                var name = ofd.FileName;
                var ccf  = ChargeCodeFile.ReadFile(name);
                Timers.Clear();
                chargeNumberStack.Children.Clear();
                CurrentTimer = null;
                foreach (var ccode in ccf.ChargeCode)
                {
                    var telement = new TimerElement(ccode.Code, ccode.Description);
                    Timers.Add(telement);
                    chargeNumberStack.Children.Add(telement);
                    telement.TimerActionPerformed += TimerActionCallback;
                }
            }
        }