Exemple #1
0
        private void AddAlarm_Click(object sender, RoutedEventArgs e)
        {
            var c = new AlarmCard();

            AlarmCards.Add(c);
            c.Show();
            c.OnClosedCalled += (s, args) =>
            {
                AlarmCard card = (AlarmCard)s;
                AlarmCards.Remove(card);
                card.Close();
            };
        }
Exemple #2
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                ImageCards = JsonConvert.DeserializeObject <List <ImageCard.Properties> >(File.ReadAllText("Images.json")).Select(p => new ImageCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                ImageCards = new List <ImageCard>();
            }
            try
            {
                ModelCards = JsonConvert.DeserializeObject <List <ModelCard.Properties> >(File.ReadAllText("Models.json")).Select(p => new ModelCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                ModelCards = new List <ModelCard>();
            }
            try
            {
                NoteCards = JsonConvert.DeserializeObject <List <NoteCard.Properties> >(File.ReadAllText("Notes.json")).Select(p => new NoteCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                NoteCards = new List <NoteCard>();
            }
            try
            {
                AlarmCards = JsonConvert.DeserializeObject <List <AlarmCard.Properties> >(File.ReadAllText("Alarms.json")).Select(p => new AlarmCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                AlarmCards = new List <AlarmCard>();
            }
            try
            {
                CheckListCards = JsonConvert.DeserializeObject <List <CheckListCard.Properties> >(File.ReadAllText("CheckLists.json")).Select(p => new CheckListCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                CheckListCards = new List <CheckListCard>();
            }

            ImageCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    ImageCard card = (ImageCard)s;
                    ImageCards.Remove(card);
                    card.Close();
                };
            });
            ModelCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    ModelCard card = (ModelCard)s;
                    ModelCards.Remove(card);
                    card.Close();
                };
            });
            NoteCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    NoteCard card = (NoteCard)s;
                    NoteCards.Remove(card);
                    card.Close();
                };
            });
            AlarmCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    AlarmCard card = (AlarmCard)s;
                    AlarmCards.Remove(card);
                    card.Close();
                };
            });
            CheckListCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    CheckListCard card = (CheckListCard)s;
                    CheckListCards.Remove(card);
                    card.Close();
                };
            });

            Notifier.MouseDown += Notifier_MouseDown;;
            Notifier.Icon       = System.Drawing.SystemIcons.Application;

            Notifier.Text = "VCards";

            Notifier.Visible = true;

            try
            {
                Theme theme = JsonConvert.DeserializeObject <Theme>(File.ReadAllText("Theme.json"));

                dark = theme.NightMode;

                ThemeOpacity = theme.Opacity;

                new PaletteHelper().SetLightDark(dark);
                new PaletteHelper().ReplacePalette(theme.Pallete);

                OnOpacityChanged(ThemeOpacity);
            }
            catch { }
        }