Exemplo n.º 1
0
        private void Remove_file()
        {
            string item = string.Empty;

            try
            {
                item = List_Files.SelectedItem.ToString();

                List_Files.Items.RemoveAt(List_Files.SelectedIndex);
            }
            catch (Exception ex)
            {
                MessageBox.Show("You need to select a line to delete it.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Information);
                Console.WriteLine(ex);
            }

            string full_item;

            if (delo.User_public_check(item))
            {
                full_item = _publicPath + '\\' + item;
            }
            else
            {
                full_item = _desktopPath + '\\' + item; //
            }
            Console.WriteLine(full_item);               // tole se izbrise iz database

            try
            {
                povezava.Izbrisi(full_item);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Database error: " + ex, "Database Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            //System.Windows.MessageBox.Show(item, "FileDialog Error", MessageBoxButton.OK, MessageBoxImage.Error);
        }
Exemplo n.º 2
0
        private void Dodaj_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (lis.SelectedItems.Count == 0)
                {
                    MessageBox.Show("Nicesar nisi izbral", "information", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                //_vrni.Clear();
                var    selectedItems = lis.SelectedItems;
                string izpis         = "";
                foreach (ListView_Data selectedItem in selectedItems)
                {
                    string name_of_file = selectedItem.Name;
                    if (podatki_za_primerjat.Contains(name_of_file))
                    {
                        izpis += ("NI DODALO: " + name_of_file + "!\n");
                        Console.WriteLine("ni dodano");
                        if (lis.SelectedItems.Count == 1)
                        {
                            break;
                        }
                    }
                    else
                    {
                        izpis += ("OK: " + name_of_file + "!\n");
                        podatki_za_primerjat.Add(name_of_file);
                        if (delo.User_public_check(name_of_file))
                        {
                            name_of_file = path2 + "\\" + selectedItem.Name;
                        }
                        else
                        {
                            name_of_file = path + "\\" + selectedItem.Name;
                        }

                        _vrni.Add(name_of_file);
                    }
                }
                MessageBox.Show(izpis, "Informacije", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Item Add Error: " + ex, "Item Add Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }