示例#1
0
        //ノートに戻る
        private void note_Click(object sender, RoutedEventArgs e)
        {
            //System.Windows.MessageBox.Show(pageNameSub + pageDirectorySub);
            DinoMainWindow mainDialog = new DinoMainWindow();

            mainDialog.Show();
            mainDialog.subShow(pageNameSub, pageDirectorySub);

            this.Close();
        }
        public void btn_Click(object sender, RoutedEventArgs e)
        {
            String pageName = sender.ToString();

            pageName = pageName.Replace("System.Windows.Controls.Button: ", "");
            int x = pageName.IndexOf(".");
            //MessageBox.Show(pageName);

            //pageName = pageName.Remove(0, x+1);

            DinoMainWindow mainDialog = new DinoMainWindow();

            mainDialog.Show();
            this.Owner = mainDialog;
            mainDialog.isfShow(subjectNamePW, pageName, pageDirectory, unitNamePage, epubFileName1, epubCurrentPageLeft1);

            this.Close();
        }
        private void createButton_Click(object sender, RoutedEventArgs e)
        {
            int newNum     = 0;
            int newPageNum = 0;

            for (newNum = 0; pageName[newNum] != null; newNum++)
            {
            }
            newPageNum = newNum + 1;

            DinoMainWindow mainDialog = new DinoMainWindow();

            mainDialog.Show();
            this.Owner = mainDialog;
            mainDialog.isfShow(subjectNamePW, newPageNum.ToString(), pageDirectory, unitNamePage, epubFileName1, epubCurrentPageLeft1);

            this.Close();
        }
        //デジタルノート起動
        private void RaunchDinoButton_Click(object sender, RoutedEventArgs e)
        {
            notePath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ContentsData\\Note";

            //note4.MainWindow dinoDalog = new note4.MainWindow();
            //dinoDalog.Show();
            //dinoDalog.isfShow(subjectName, "1.isf", notePath + "\\" + subjectName + "\\" + unitName[currentPageLeft]);

            if (dinoNowOpening.Contains("none"))
            {
                if (drawingFlag)
                {
                    BrowserCapture();
                }

                DinoPageWindow dinoPageWin = new DinoPageWindow();
                dinoPageWin.Show();
                dinoPageWin.pageShow(subjectName, unitName[currentPageSingle], epubFileName, currentPageSingle);

                this.Close();
            }
            else
            {
                if (drawingFlag)
                {
                    BrowserCapture();
                }

                DinoMainWindow dinoMainWin = new DinoMainWindow();
                dinoMainWin.Show();
                dinoMainWin.isfShow(subjectName, dinoNowOpening, notePath + "\\" + subjectName + "\\" + unitName[currentPageSingle], unitName[currentPageSingle], epubFileName, currentPageSingle);

                this.Close();
            }

        }
        private void CaptureScreen(Point point)
        {
            // 座標変換
            var start = PointToScreen(_position);
            var end   = PointToScreen(point);

            // キャプチャエリアの取得
            var x      = start.X < end.X ? (int)start.X : (int)end.X;
            var y      = start.Y < end.Y ? (int)start.Y : (int)end.Y;
            var width  = (int)Math.Abs(end.X - start.X);
            var height = (int)Math.Abs(end.Y - start.Y);

            if (width == 0 || height == 0)
            {
                return;
            }

            // スクリーンイメージの取得
            using (var bmp = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb))
                using (var graph = System.Drawing.Graphics.FromImage(bmp))
                {
                    // 画面をコピーする
                    graph.CopyFromScreen(new System.Drawing.Point(x, y), new System.Drawing.Point(), bmp.Size);

                    string   pageFileName = pagePath.Replace(epubDirectory + "\\OEBPS\\image\\", "");
                    string   captureFileDirectory;
                    string[] files;

                    //ファイル共有するならこっち
                    if (Directory.Exists(GetUniversalName(@"\\MCDYNA20\ContentsData")))
                    {
                        captureFileDirectory =
                            @"\\MCDYNA20\ContentsData\Annotation\" + ((PNGWindow)this.Owner).user.GetId() + "\\" + ((PNGWindow)this.Owner).epubFileName.Replace(".epub", "");

                        string unc_path = GetUniversalName(captureFileDirectory);

                        //自分のアノテーションファイルの置き場がなければつくる
                        if (!Directory.Exists(unc_path))
                        {
                            Directory.CreateDirectory(unc_path);
                        }

                        //保存先にページ.pngが何枚保存されているか調べる
                        files = System.IO.Directory.GetFiles(captureFileDirectory, pageFileName + "*" + ".png", System.IO.SearchOption.TopDirectoryOnly);
                    }

                    //しないならこっち
                    else
                    {
                        captureFileDirectory =
                            ((PNGWindow)this.Owner).epubDirectory.Replace("epub", "Annotation\\") + ((PNGWindow)this.Owner).user.GetId() + "\\" + ((PNGWindow)this.Owner).epubFileName.Replace(".epub", "");


                        //自分のアノテーションファイルの置き場がなければつくる
                        if (!Directory.Exists(captureFileDirectory))
                        {
                            Directory.CreateDirectory(captureFileDirectory);
                        }

                        //保存先にページ.pngが何枚保存されているか調べる
                        files = System.IO.Directory.GetFiles(captureFileDirectory, pageFileName + "*" + ".png", System.IO.SearchOption.TopDirectoryOnly);
                    }
                    string k = null;


                    int i = 0;
                    foreach (string f in files)
                    {
                        i++;
                    }
                    if (i < 100)
                    {
                        k = "0" + i;
                        if (i < 10)
                        {
                            k = "0" + k;
                        }
                    }

                    //imageを保存
                    savePath = captureFileDirectory + "\\" + pageFileName + "_" + k + ".png";

                    //すでに保存されている枚数に応じて番号をつけて保存
                    bmp.Save(savePath, System.Drawing.Imaging.ImageFormat.Png);
                }

            //「おくる」ボタンをクリックしていた場合は、クリップボードにコピー
            if (needToClip)
            {
                MemoryStream    data  = new MemoryStream(File.ReadAllBytes(savedFilePath));
                WriteableBitmap bmpim = new WriteableBitmap(BitmapFrame.Create(data));
                data.Close();
                Clipboard.SetImage(bmpim);
                bool a = File.Exists(savePath);
                //File.Delete(savedFilePath);

                DinoMainWindow dinoMain = new DinoMainWindow();
                dinoMain.Show();
                dinoMain.pasteClipBorad(subjectName, unitName, savedFilePath);
            }
        }