コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: YuZic20/WpfApp7
 private void CopyApk(PrgData sender)
 {
     try
     {
         System.IO.Directory.CreateDirectory(CopyPathInput.Text);
         System.IO.Directory.Move(sender.DirectoryPath, CopyPathInput.Text + "/" + sender.Name);
     }
     catch (Exception)
     {
         ErrMsg.Text = "nevalidní cesta pro destinaci projektu";
     }
     UpdateAppsWithPrewPath();
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: YuZic20/WpfApp7
        private void DeleteApk(PrgData sender)
        {
            if (System.IO.Directory.Exists(sender.DirectoryPath))
            {
                try
                {
                    string ParentPath = System.IO.Directory.GetParent(sender.DirectoryPath).ToString();
                    System.IO.Directory.Delete(ParentPath, true);
                }

                catch (Exception e)
                {
                    ErrMsg.Text = "Složku se nepodařilo celu smazat. důvod: " + e.Message;
                }
                UpdateAppsWithPrewPath();
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: YuZic20/WpfApp7
        private void Apk_Click(object sender, RoutedEventArgs e)
        {
            ErrMsg.Text = "";
            Button bt = (Button)sender;

            int Id = Int32.Parse(bt.Tag.ToString());

            PrgData ButtonData = AppList[Id];

            if (action == 1)
            {
                LastApkClickedToDelete = Id;
                PopUp.Visibility       = Visibility.Visible;
                //delete
            }
            else if (action == 2)
            {
                StartApk(ButtonData);
            }
            else if (action == 3)
            {
                CopyApk(ButtonData);
            }
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: YuZic20/WpfApp7
 private void StartApk(PrgData sender)
 {
     Process.Start(sender.Path);
 }
コード例 #5
0
ファイル: LoadList.cs プロジェクト: YuZic20/WpfApp7
        public static List <PrgData> GetExe(string SPath)
        {
            List <PrgData> AppList = new List <PrgData>();
            List <string>  text    = new List <string>();
            List <string>  exes    = new List <string>();


            text = ApplyAllFiles(SPath); //Directory.GetFiles(SPath, "*.csproj", SearchOption.AllDirectories).ToList();

            foreach (string projpath in text)
            {
                try
                {
                    XDocument docNode = XDocument.Load(projpath);
                    var       fnode   = docNode.Descendants().First(p => p.Name.LocalName == "OutputPath");
                    var       lnode   = docNode.Descendants().Last(p => p.Name.LocalName == "OutputPath");

                    string name = System.IO.Path.GetFileNameWithoutExtension(projpath);//.Remove(System.IO.Path.GetFileName(projpath).Count() - 7);

                    string path = projpath.Remove(projpath.Count() - name.Count() - 7);

                    string DirectoryPath = System.IO.Directory.GetParent(path).ToString();

                    DirectoryPath = System.IO.Directory.GetParent(DirectoryPath).ToString();


                    string Fpath = path + fnode.Value;

                    string Lpath = path + lnode.Value;

                    exes = GetListOfExes(Fpath, Lpath);
                    string LatestExePath;
                    if (exes.Count() != 0)
                    {
                        LatestExePath = GetRecentExe(exes);
                        PrgData Prog = new PrgData(name, LatestExePath, DirectoryPath);

                        AppList.Add(Prog);
                    }
                }
                catch
                {
                    // error nodu
                }



                /*
                 * int Select = 0;
                 * int SelectErr = 0;
                 * DateTime lastModifiedF;
                 * DateTime lastModifiedL;
                 * try
                 * {
                 *  lastModifiedF = System.IO.File.GetLastWriteTime(Fpath);
                 * }
                 * catch (Exception)
                 * {
                 *  SelectErr++;
                 *  Select = 2;
                 * }
                 * try
                 * {
                 *  lastModifiedL = System.IO.File.GetLastWriteTime(Lpath);
                 * }
                 * catch (Exception)
                 * {
                 *  SelectErr++;
                 *  Select = 1;
                 * }
                 */
            }
            return(AppList);
        }