Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //System.Windows.MessageBox.Show(this.selctpic.SelectedValue.ToString());
            if (fileath.Text == "")
            {
                reslut = string.Empty;
            }
            else
            {
                reslut = filePath;
                if (picTitle.Text == "")
                {
                    pic_title = System.IO.Path.GetFileNameWithoutExtension(fileath.Text);
                }
                else
                {
                    pic_title = picTitle.Text;
                }
                reslut = reslut + "@@@" + pic_title;
            }
            if (issave)
            {
                title newmedia = new title()
                {
                    date       = DateTime.Now.ToString(),
                    title_name = System.IO.Path.GetFileName(fileath.Text),
                    context    = fileath.Text
                };
                MainWindow.tree5_sel.media.Add(newmedia);

                //ThreadPool.QueueUserWorkItem(new WaitCallback(idisser_data.AddiDissertationMedia), (object)newmedia);
            }
            File.Copy(fileath.Text, filePath, true);
            this.Close();
        }
Пример #2
0
        private void showcotext()
        {
            //this.webBrowser1.DocumentCompleted
            // ObservableCollection<title> itemlist = new ObservableCollection<title>();
            //title
            title id1 = new title()
            {
                ID         = "1",
                title_name = "saaeqw",
                date       = "2014-04-05",
                context    = "a的点对点的熬到asadadasddddddq34455",
                image      = "/WpfApplication1;component/Images/add.ico",
            };
            title id2 = new title()
            {
                ID         = "2",
                title_name = "的受委屈",
                date       = "2014-04-05",
                context    = "豆丁网对点的熬到asadadasddddddq3445",
                image      = "/WpfApplication1;component/Images/attributes.ico",
            };

            itemlist.Add(id1);
            //ltitle_item.Add(id1);
            // listdata.title_item.Add(id2);
            itemlist.Add(id2);
            this.listView1.ItemsSource = itemlist;
        }
Пример #3
0
        public static ObservableCollection <title> Getfiles(string aiDirectoryInfo)
        {
            // = new ObservableCollection<title>();
            ObservableCollection <title> items = new ObservableCollection <title>();

            if (aiDirectoryInfo[aiDirectoryInfo.Length - 1] != Path.DirectorySeparatorChar)
            {
                aiDirectoryInfo += Path.DirectorySeparatorChar;
            }
            string[] fileList = Directory.GetFileSystemEntries(aiDirectoryInfo);
            foreach (string filename in fileList)
            {
                if (Directory.Exists(filename))
                {
                    ObservableCollection <title> cc = Getfiles(aiDirectoryInfo + Path.GetFileName(filename));
                    foreach (title i in cc)
                    {
                        items.Add(i);
                    }
                    // cc = new ObservableCollection<title>(ccc);
                }
                else
                {
                    title file = new title()
                    {
                        context    = filename,
                        title_name = Path.GetFileName(filename),
                        date       = File.GetLastWriteTime(filename).ToString()
                    };
                    items.Add(file);
                }
            }
            return(items);
        }
Пример #4
0
 private void MenuItem_delete(object sender, RoutedEventArgs e)
 {
     if (listView1.SelectedItem == null)
     {
         return;
     }
     else
     {
         PropertyNodeItem de = ((PropertyNodeItem)tree2.Items[0]).Children[last - 2];
         count--;
         cc = (title)listView1.SelectedItem;
         PropertyNodeItem cs = new PropertyNodeItem()
         {
             DisplayName = cc.title_name,
             Name        = cc.title_name,
             Icon        = "",
             parent      = de,
             node_lev    = Nodeetype.note
         };
         isdrag = true;
         itemlist.Remove(cc);
         label4.Content = count.ToString() + "条";
         de.Children.Add(cs);
     }
 }  //删除个人主题
Пример #5
0
        private void OnPreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (Mouse.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }
            System.Windows.Point pos    = e.GetPosition(listView1);
            HitTestResult        result = VisualTreeHelper.HitTest(listView1, pos);

            if (result == null)
            {
                return;
            }
            ListViewItem listitem = Utils.FindVisualParent <ListViewItem>(result.VisualHit);

            if (listitem == null || !(listView1.SelectedItem is title))
            {
                return;
            }
            DragDropAdorner adorner = new DragDropAdorner(listitem);

            // mAdornerLayer=
            mAdornerLayer = AdornerLayer.GetAdornerLayer(mTopLevelGrid);
            mAdornerLayer.Add(adorner);
            cc = listitem.Content as title;
            object db = (object)cc.title_name;

            // DataObject db = new DataObject((Object)cc.title_name);
            System.Windows.DragDrop.DoDragDrop(listView1, db, DragDropEffects.Copy);
            mStartHoverTime = DateTime.MinValue;
            mHoveredItem    = null;
            mAdornerLayer.Remove(adorner);
            mAdornerLayer = null;
        }
Пример #6
0
        public string MN_OpenFile(string filter)
        {
            string         filePath        = "";
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Multiselect      = false;
            openFileDialog1.InitialDirectory = MainWindow.tree5_sel.mediaPath;
            openFileDialog1.Filter           = filter;//"mp4文件|*.mp4";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                filePath = MainWindow.tree5_sel.href + "\\dialogs\\video\\" + openFileDialog1.SafeFileName;
                File.Copy(openFileDialog1.FileName, filePath, true);
                title newmedia = new title()
                {
                    date       = DateTime.Now.ToString(),
                    title_name = Path.GetFileName(filePath),
                    context    = filePath
                };
                MainWindow.tree5_sel.media.Add(newmedia);
                if (File.Exists(MainWindow.tree5_sel.mediaPath + "\\" + openFileDialog1.SafeFileName) == false)
                {
                    ThreadPool.QueueUserWorkItem(status => copy_files.AddiDissertationMedia(openFileDialog1.FileName, MainWindow.tree5_sel.mediaPath + "\\" + openFileDialog1.SafeFileName));
                }
            }
            return(filePath);
        }
Пример #7
0
        private void MenuItem_modify(object sender, RoutedEventArgs e)
        {
            cc      = this.listView1.SelectedItem as title;
            newname = cc.title_name;
            Window1 w1 = new Window1();

            w1.getname(newname, 1);
            w1.getnote += new Window1.myevent(m_window1_modify_notetitle);
            w1.Show();
        }
Пример #8
0
        }  //删除个人主题

        private void note_add_Click(object sender, RoutedEventArgs e)   //增加新笔记触发的事件
        {
            int   id      = listView1.Items.Count;
            title newtile = new title()
            {
                ID         = id.ToString(),
                title_name = "未命名",
                date       = "刚刚",
                context    = "",
                image      = "",
            };

            itemlist.Insert(0, newtile);
            count++;
            label4.Content = count.ToString() + "条";
        }
Пример #9
0
        public MusicFile MN_OpenMusicFile()
        {
            string         filePath        = "";
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = MainWindow.tree5_sel.mediaPath;
            openFileDialog1.Multiselect      = false;
            openFileDialog1.Filter           = "mp3文件|*.mp3";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                filePath = openFileDialog1.FileName;
                Mp3Info info     = Mp3FileInfo.GetMp3FileInfo(filePath);
                title   newmedia = new title()
                {
                    date       = DateTime.Now.ToString(),
                    title_name = info.Title,
                    context    = filePath
                };
                MainWindow.tree5_sel.media.Add(newmedia);
                if (File.Exists(MainWindow.tree5_sel.mediaPath + "\\" + openFileDialog1.SafeFileName) == false)
                {
                    ThreadPool.QueueUserWorkItem(status => copy_files.AddiDissertationMedia(openFileDialog1.FileName, MainWindow.tree5_sel.mediaPath + "\\" + openFileDialog1.SafeFileName));
                }
                if (true)//MainWindow.CurIsIdissertation)
                {
                    filePath = MainWindow.tree5_sel.href + "\\dialogs\\music\\" + openFileDialog1.SafeFileName;
                    File.Copy(openFileDialog1.FileName, filePath, true);
                }
                else
                {
                    filePath = openFileDialog1.FileName;
                }
                MusicFile mf = new MusicFile()
                {
                    FileName   = info.Title,
                    FilePath   = filePath,
                    AlbumTitle = info.Album,
                    Author     = info.Artist
                };
                return(mf);
            }
            return(null);
        }
Пример #10
0
 private void listView1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //title c = (title)listView1.SelectedItem;
     //MessageBox.Show(c.title_name);
     if (web_show)
     {
         this.webBrowser1.Navigate("file:///F:/ueditor1_3_6-src_tofuchangli/ueditor1_3_6-src/index.html");
         web_show = false;
     }
     cc = (title)listView1.SelectedItem;
     if (isdrag == true)
     {
         return;
     }
     textBox2.Text = cc.title_name;
     isdrag        = false;
     if (invoker.WaitWebPageLoad() == true)
     {
         invoker.InvokeScript("setContent", "sadfasdfasfaf1111111fu");
     }
 }
Пример #11
0
        private void OnDrop(object sender, DragEventArgs e)
        {
            //MessageBox.Show(e.Data.GetData(typeof(string)));
            System.Windows.Point ps     = e.GetPosition(tree2);
            HitTestResult        result = VisualTreeHelper.HitTest(tree2, ps);

            if (result == null)
            {
                return;
            }
            TreeViewItem selectedItem = Utils.FindVisualParent <TreeViewItem>(result.VisualHit);

            if (selectedItem == null)
            {
                return;
            }
            PropertyNodeItem parent = selectedItem.Header as PropertyNodeItem;

            cc = (title)listView1.SelectedItem;
            string data = e.Data.GetData(typeof(string)) as string;
            //isdrag = true;
            PropertyNodeItem newitem = new PropertyNodeItem()
            {
                DisplayName = data,
                Name        = data,
                Icon        = "",
                parent      = parent,
            };

            if (parent != null && newitem != null)
            {
                parent.Children.Add(newitem);
                itemlist.Remove(cc);
                label4.Content = (count - 1).ToString() + "条";
            }
            isdrag = false;
        }
Пример #12
0
 private void m_window1_modify_notetitle(object sender, Window1.textEventArgs e)   //修改笔记名入口
 {
     newname       = e.textbox;
     cc            = (title)listView1.SelectedItem;
     cc.title_name = newname;
 }