private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // 設定から読み取る。
            this.Left   = Properties.Settings.Default.WindowLeft;
            this.Top    = Properties.Settings.Default.WindowTop;
            this.Width  = Properties.Settings.Default.WindowWidth;
            this.Height = Properties.Settings.Default.WindowHeight;

            this.label_FindFolder.Content = Properties.Settings.Default.FindFolder;
            this.comboBox_FindFile.Text   = Properties.Settings.Default.FindFile;

            file_Finds = File_Finds.FileLoad("FindFiles.xml");

            GetFileFindsSort();

            // FindFolderが何も無かったら、
            if (label_FindFolder.Content.Equals(""))
            {
                // FindFolderに初期値を送る
                label_FindFolder.Content = "C:\\";
            }

            if (comboBox_FindFile.Text.Equals(""))
            {
                button_FileFind.IsEnabled = false;
            }
            else
            {
                button_FileFind.IsEnabled = true;
            }

            button_Copy.IsEnabled        = false;
            button_AddressCopy.IsEnabled = false;
        }
Beispiel #2
0
        static public void FileSave(string file_path, File_Finds file)
        {
            var serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(File_Finds));

            using (var fs = new FileStream(file_path, FileMode.Create))
            {
                serializer.WriteObject(fs, file);
            }
        }
Beispiel #3
0
        static public File_Finds FileLoad(string file_path)
        {
            if (File.Exists(file_path))
            {
                using (var fs = new FileStream(file_path, FileMode.Open))
                {
                    var serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(File_Finds));

                    File_Finds file = (File_Finds)serializer.ReadObject(fs);

                    return(file);
                }
            }

            return(new File_Finds());
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (this.WindowState == WindowState.Normal)
            {
                // 設定に書き込む。
                Properties.Settings.Default.WindowLeft   = this.Left;
                Properties.Settings.Default.WindowTop    = this.Top;
                Properties.Settings.Default.WindowWidth  = this.Width;
                Properties.Settings.Default.WindowHeight = this.Height;
            }

            // 設定にフォルダ名を書き込む。
            Properties.Settings.Default.FindFolder = (string)this.label_FindFolder.Content;
            Properties.Settings.Default.FindFile   = this.comboBox_FindFile.Text;

            // 設定に送ったものをセーブ。
            Properties.Settings.Default.Save();

            // 設定ファイルを、指定した文字列にセーブする
            File_Finds.FileSave("FindFiles.xml", file_Finds);
        }