コード例 #1
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            LocalFiles.Clear();
            RemoteFiles.Clear();

            string sel_card_folder = lbCards.SelectedItem.ToString();
            string[] all_files = Globals.GetFiles(sel_card_folder);
            string root = Globals.GetExecutablePath();

            LocalFiles.AddRange(all_files);

            string remote_file = "";
            for (int i = 0; i < all_files.Length; i++)
            {
                remote_file = all_files[i].Replace(root, "/");
                remote_file = remote_file.Replace("\\", "/");
                RemoteFiles.Add(remote_file);
            }


            file_indx = 0;
            lblCount.Text = string.Format("{0} of {1}", file_indx + 1, LocalFiles.Count);

            try
            {
                //txtLog.AppendText(string.Format("Copy: '{0}' to '{1}'\r\n", LocalFiles[file_indx], RemoteFiles[file_indx]));
                com.FileCopyTo(LocalFiles[file_indx], RemoteFiles[file_indx]);
            }
            catch (Exception ex)
            {
                txtLog.AppendText(ex.Message + "\r\n");
            }
        }
コード例 #2
0
        internal static string GetDefaultGroupPath()
        {
            KeyValPair kv = new KeyValPair(';', ':');
            string     settings_file_name = Globals.GetExecutablePath() + "Settings.stg";

            kv.Load(settings_file_name);
            string def_group = kv.GetVal("DefaultGroup");

            return(def_group);
        }
コード例 #3
0
        internal static void SetDefaultGroup(string DefaultCardGroupPath)
        {
            if (Directory.Exists(DefaultCardGroupPath) == false)
            {
                return;
            }

            KeyValPair kv = new KeyValPair(';', ':');
            string     settings_file_name = Globals.GetExecutablePath() + "Settings.stg";

            kv.Load(settings_file_name);
            kv.SetVal("DefaultGroup", DefaultCardGroupPath);
            kv.Save(settings_file_name);
        }
コード例 #4
0
        private void btnSendToPhone_Click(object sender, EventArgs e)
        {
            if (dgvCards.SelectedRows.Count == 0) return;

            LocalFiles.Clear();
            RemoteFiles.Clear();

            List<string> pc_side_cards = new List<string>();
            for (int i = 0; i < dgvCards.SelectedRows.Count; i++)
            {
                pc_side_cards.Add((string)dgvCards.SelectedRows[i].Cells[clmnCardPathPc.Index].Value);
            }

            foreach (string card in pc_side_cards)
            {
                string[] all_files = Globals.GetFiles(card);
                if (all_files == null) continue;
                string root = Globals.GetExecutablePath();
                LocalFiles.AddRange(all_files);
                
                string remote_file = "";
                for (int i = 0; i < all_files.Length; i++)
                {
                    remote_file = all_files[i].Replace(root, "/");
                    remote_file = remote_file.Replace("\\", "/");
                    RemoteFiles.Add(remote_file);
                }
            }

            file_indx = 0;
            lblCount.Text = string.Format("{0} of {1}", file_indx + 1, LocalFiles.Count);
            pbProgress.Maximum = LocalFiles.Count;
            pbProgress.Value = file_indx + 1;
            try
            {
                //txtLog.AppendText(string.Format("Copy: '{0}' to '{1}'\r\n", LocalFiles[file_indx], RemoteFiles[file_indx]));
                com.FileCopyTo(LocalFiles[file_indx], RemoteFiles[file_indx]);
            }
            catch (Exception ex)
            {
                // txtLog.AppendText(ex.Message + "\r\n");
            }
        }
コード例 #5
0
        private void foo()
        {
            string folder = Globals.GetExecutablePath() + "C1020\\";

            Directory.CreateDirectory(folder);

            for (int i = 0; i < grdContent.RowDefinitions.Count; i++)
            {
                if (grdContent.RowDefinitions[i].Height != new GridLength(0))
                {
                    ContentItem ci = (ContentItem)grdContent.RowDefinitions[i].Tag;
                    //MessageBox.Show(ci.ContentFile);
                    FileInfo fi = new FileInfo(ci.ContentFile);
                    File.Copy(ci.ContentFile, folder + ((i + 1).ToString()).PadLeft(3, '0') + fi.Extension, true);
                }
            }

            Process.Start(folder);
        }
コード例 #6
0
        private void btnFetchFile_Click(object sender, EventArgs e)
        {
            if (this.FetchList == null) return;
            if (this.FetchList.Length == 0) return;
            string f = FetchList[0];

            IncomingTempFolder = Globals.GetExecutablePath() + "TMP" + Globals.GetDateTimeStamp() + "\\";
            IncomingTempFolder = Globals.CreateFolder(IncomingTempFolder);
            if (IncomingTempFolder == null)
            {
                MessageBox.Show("Unable to create temp folder.");
                return;
            }
            
            txtLog.AppendText("\r\n");
            txtLog.AppendText("---------------------------------");
            txtLog.AppendText("\r\n");
            
            com.FetchFile(f, IncomingTempFolder);
        }
コード例 #7
0
        public static void OpenImageEditor(string ImageFile)
        {
            KeyValPair kv = new KeyValPair(';', ':');

            kv.Load(Globals.GetExecutablePath() + "settings.stg");
            string image_editor_path = kv.GetVal("ImageEditor");

            if (File.Exists(image_editor_path) == false)
            {
                return;
            }
            try
            {
                Process.Start(image_editor_path, ImageFile);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
 public static int GetShuldBuildHtmlDocs()
 {
     if (ShouldBuildHtmlDocs == -1)
     {
         KeyValPair kv = new KeyValPair(';', ':');
         string     settings_file_name = Globals.GetExecutablePath() + "Settings.stg";
         kv.Load(settings_file_name);
         string build_html_docs_str = kv.GetVal("BuildHtmlDocs");
         try
         {
             ShouldBuildHtmlDocs = int.Parse(build_html_docs_str);
         }
         catch
         {
             //MessageBox.Show("Building HTML documents is disabled.");
             ShouldBuildHtmlDocs = 0;
         }
     }
     return(ShouldBuildHtmlDocs);
 }
コード例 #9
0
        private void Init()
        {
            Globals.Root = Globals.GetExecutablePath();

            StopAlAu();
            this.WindowStartupLocation = WindowStartupLocation.Manual;
            System.Drawing.Rectangle rect = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
            this.Width  = 300;
            this.Height = rect.Height;
            this.Top    = 0;
            this.Left   = rect.Width - this.Width;


            this.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(MainWindow_PreviewKeyDown);

            ctrlHome.OnReq_SetDefaultGroup += new EventHandler(ctrlHome_OnReq_SetDefaultGroup);
            ctrlHome.wndMainWindow          = this;


            PresentContent(ctrlHome);
            //PresentContent(ctrlContent);
            //WndTest t = new WndTest();
            //t.ShowDialog();
        }
コード例 #10
0
        public string FetchFile(string RemoteFullFileName)
        {
            string local_dir_path = Globals.GetExecutablePath();

            return(FetchFile(RemoteFullFileName, local_dir_path));
        }