コード例 #1
0
        private void Delete_Alarm(object sender, RoutedEventArgs e)
        {
            var indexx = dataGrid2.Items.IndexOf(dataGrid2.CurrentItem);
            int omg    = indexx;

            Baza.DeleteAlarms(omg + 1);

            alarm_lab.Content = "Usunięto alarm";

            List <Alarm> alarm2 = new List <Alarm>();

            alarm2 = Baza.AlarmList2();
            dataGrid2.ItemsSource = alarm2;
        }
コード例 #2
0
        public static void appMovement(int FuncNumb)
        {
            ConsoleKeyInfo keypress;

            Console.SetCursorPosition(6, 6);

            int col = 6, row = 6;

            keypress = Console.ReadKey();

            while (keypress.Key != ConsoleKey.F9)
            {
                if (keypress.Key == ConsoleKey.RightArrow && col == 6)
                {
                    Console.SetCursorPosition(col += 15, row);
                }

                if (keypress.Key == ConsoleKey.RightArrow && col == 21)
                {
                    Console.SetCursorPosition(col, row);
                }


                if (keypress.Key == ConsoleKey.LeftArrow && col == 21)
                {
                    Console.SetCursorPosition(col -= 15, row);
                }

                if (keypress.Key == ConsoleKey.LeftArrow && col == 6)
                {
                    Console.SetCursorPosition(col, row);
                }


                if (keypress.Key == ConsoleKey.UpArrow && row != 6)
                {
                    Console.SetCursorPosition(col, row -= 4);
                }


                if (keypress.Key == ConsoleKey.UpArrow && row == 6)
                {
                    Console.SetCursorPosition(col, row);
                }


                if (keypress.Key == ConsoleKey.DownArrow)
                {
                    Console.SetCursorPosition(col, row += 4);
                }



                //Delete
                if (keypress.Key == ConsoleKey.Enter && col == 21)
                {
                    int todelete;
                    int numer = Console.CursorTop;

                    todelete = (numer - 2) / 4;

                    if (FuncNumb == 2)
                    {
                        Baza.DeleteContact(todelete); Functions.createContactInterface();
                    }
                    if (FuncNumb == 3)
                    {
                        Baza.DeleteMeet(todelete);    Functions.createMeetInterface();
                    }
                    if (FuncNumb == 4)
                    {
                        Baza.DeleteAddress(todelete); Functions.createAddressInterface();
                    }
                    if (FuncNumb == 5)
                    {
                        Baza.DeleteAlarms(todelete); Functions.createAlarmInterface();
                    }
                    if (FuncNumb == 6)
                    {
                        Baza.DeleteNotes(todelete); Functions.createNoteInterface();
                    }
                }


                //Edit
                if (keypress.Key == ConsoleKey.Enter && col == 6)
                {
                    int toedit;
                    int numer = Console.CursorTop;

                    toedit = (numer - 2) / 4;

                    if (FuncNumb == 2)
                    {
                        Functions.editContactInterface(toedit);
                    }
                    if (FuncNumb == 3)
                    {
                        editNumber = toedit;
                        DateTime data = DateTime.Now;
                        new Calendar(data, 4);
                    }
                    if (FuncNumb == 4)
                    {
                        Functions.editAddressInterface(toedit);
                    }
                    if (FuncNumb == 5)
                    {
                        Functions.setUpAlarm(toedit);
                    }
                    if (FuncNumb == 6)
                    {
                        editNumber = toedit; new Notes(DateTime.Now, 2);
                    }
                }



                //Start
                if (keypress.Key == ConsoleKey.F1)
                {
                    Functions.createStartInterface();
                }

                //Kontakty
                if (keypress.Key == ConsoleKey.F2)
                {
                    Functions.createContactInterface();
                }

                //Spotkania
                if (keypress.Key == ConsoleKey.F3)
                {
                    Functions.createMeetInterface();
                }

                //Adresy
                if (keypress.Key == ConsoleKey.F4)
                {
                    Functions.createAddressInterface();
                }

                //Alarmy
                if (keypress.Key == ConsoleKey.F5)
                {
                    Functions.createAlarmInterface();
                }

                //Notatki
                if (keypress.Key == ConsoleKey.F6)
                {
                    Functions.createNoteInterface();
                }


                //Add
                if (keypress.Key == ConsoleKey.F7)
                {
                    if (FuncNumb == 2)
                    {
                        Functions.addContactInterface();
                    }
                    if (FuncNumb == 3)
                    {
                        DateTime data = DateTime.Now;

                        new Calendar(data, 3);
                    }
                    if (FuncNumb == 4)
                    {
                        Functions.addAddressInterface();
                    }
                    if (FuncNumb == 5)
                    {
                        Functions.addAlarmInterface();
                    }
                    if (FuncNumb == 6)
                    {
                        new Notes(DateTime.Now, 1);
                    }
                }



                keypress = Console.ReadKey();
            }

            Environment.Exit(0);
        }