コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: h0kd33/KomiCopy
        private void On_CMB_FileCount_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int selCount = CMB_FileCount.SelectedIndex + 2;

            while (_fileColle.Count > selCount)
            {
                _fileColle.RemoveAt(selCount);
            }

            while (_fileColle.Count < selCount)
            {
                CopyFileVM addFile = new CopyFileVM();
                _fileColle.Add(addFile);
            }
        }
コード例 #2
0
        private void On_Border_Drop(object sender, DragEventArgs e)
        {
            _vm = this.DataContext as CopyFileVM;
            if (_vm == null)
            {
                return;
            }

            String[] dropFiles = (String[])e.Data.GetData(DataFormats.FileDrop);
            _vm.FilePath = dropFiles[0];
            try
            {
                _vm.ImageObject = LoadImage(_vm.FilePath);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(String.Format("Set image source fail:{0}", ex.Message));
                String fileExt = System.IO.Path.GetExtension(_vm.FilePath);
                _vm.FileDesc    = String.Format("{0} file", fileExt);
                _vm.ImageObject = null;
            }
        }