示例#1
0
        public void OpenCdrFile()
        {
            if (lst.SelectedIndex == -1)
            {
                return;
            }
            CdrFile c = (CdrFile)lst.SelectedItem;

            if (File.Exists(c.cdr_filepath))
            {
                foreach (Document doc in RFcontrol.dApp.Documents)
                {
                    if (doc.FullFileName == c.cdr_filepath)
                    {
                        MessageBox.Show("This file is already open.", RFcontrol.mName, MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }
                RFcontrol.dApp.OpenDocument(c.cdr_filepath);
                this.Visibility = Visibility.Hidden;
            }
            else
            {
                MessageBox.Show("The file not found", RFcontrol.mName, MessageBoxButton.OK, MessageBoxImage.Information);
                if (RFcontrol.db.DeleteFromDB(c.cdr_filepath))
                {
                    RFcontrol.db.LoadList();
                }
            }
        }
示例#2
0
        private void mDelete(object sender, RoutedEventArgs e)
        {
            if (lst.SelectedIndex == -1)
            {
                return;
            }

            if (MessageBox.Show("Are you sure you want to delete this file from disk?",
                                RFcontrol.mName, MessageBoxButton.YesNo, MessageBoxImage.Question).GetHashCode() == 6)
            {
                CdrFile c = (CdrFile)lst.SelectedItem;
                try
                {
                    if (File.Exists(c.cdr_filepath))
                    {
                        File.Delete(c.cdr_filepath);
                        if (RFcontrol.db.DeleteFromDB(c.cdr_filepath))
                        {
                            RFcontrol.db.LoadList();
                        }
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
            }
        }
示例#3
0
        private void mReveal(object sender, RoutedEventArgs e)
        {
            if (lst.SelectedIndex == -1)
            {
                return;
            }
            CdrFile c = (CdrFile)lst.SelectedItem;

            openFolder(c.cdr_filepath);
        }
示例#4
0
        private void mDeleteItem(object sender, RoutedEventArgs e)
        {
            if (lst.SelectedIndex == -1)
            {
                return;
            }
            CdrFile c = (CdrFile)lst.SelectedItem;

            if (RFcontrol.db.DeleteFromDB(c.cdr_filepath))
            {
                RFcontrol.db.LoadList();
            }
        }
示例#5
0
        private void mCloseFile(object sender, RoutedEventArgs e)
        {
            if (lst.SelectedIndex == -1)
            {
                return;
            }
            CdrFile c = (CdrFile)lst.SelectedItem;

            foreach (Corel.Interop.VGCore.Document d in RFcontrol.dApp.Documents)
            {
                if (c.cdr_filepath == d.FullFileName)
                {
                    if (d.Dirty)
                    {
                        int state = MessageBox.Show(
                            "Save changes to " + c.cdr_file_name + "?",
                            RFcontrol.mName,
                            MessageBoxButton.YesNoCancel,
                            MessageBoxImage.Question
                            ).GetHashCode();

                        switch (state)
                        {
                        //case 2: //Cansel
                        case 6:
                            d.Save();
                            d.Close();
                            break;

                        case 7:
                            d.Close();
                            break;
                        }
                        return;
                    }
                    else
                    {
                        d.Close();
                        return;
                    }
                }
            }
        }