Esempio n. 1
0
        private void MainPanel_Drop(object sender, DragEventArgs e)
        {
            var files = ((DataObject)e.Data).GetFileDropList().Cast <string>().ToList();

            if (files.Count == 0)
            {
                return;
            }
            foreach (var file in files)
            {
                if (file.EndsWith(".lnk"))
                {
                    var filename = Path.GetFileName(file);
                    var dest     = Path.Combine(DashboardParam.ApplicaitonPath, filename);
                    File.Copy(file, dest, true);
                    SetFullContorol(dest);
                }
                else
                {
                    var f = ApplicationUtility.CreateShrotcutFile(file, DashboardParam.ApplicaitonPath);
                    SetFullContorol(f);
                }
            }
            Reload();
        }
Esempio n. 2
0
        // private string config = @"./Resources/config.json";

        public MainWindow()
        {
            string config = ApplicationUtility.GetUserAppDataPath() + @"\WinBoard\config.json";

            //string ResourcesPath = @"./Resources";
            InitializeComponent();
            if (!File.Exists(config))
            {
                return;
            }
            AppPath appPath = new AppPath();

            using (var sr = new StreamReader(System.IO.Path.GetFullPath(config), System.Text.Encoding.UTF8))
            {
                var json = sr.ReadToEnd();
                appPath = JsonConvert.DeserializeObject <AppPath>(json);
            }

            if (appPath.r_SearchColor < 256 && appPath.r_SearchColor > 0)
            {
                DashboardParam.rSerachColor = appPath.r_SearchColor;
            }
            else
            {
                DashboardParam.rSerachColor = 0;
            }

            if (appPath.g_SearchColor < 256 && appPath.g_SearchColor > 0)
            {
                DashboardParam.gSearchColor = appPath.g_SearchColor;
            }
            else
            {
                DashboardParam.gSearchColor = 0;
            }
            if (appPath.b_SearchColor < 256 && appPath.b_SearchColor > 0)
            {
                DashboardParam.bSearchColor = appPath.b_SearchColor;
            }
            else
            {
                DashboardParam.bSearchColor = 0;
            }

            TextColorChange(SearchText, (byte)DashboardParam.rSerachColor, (byte)DashboardParam.gSearchColor, (byte)DashboardParam.bSearchColor);

            //背景画像が指定されていれば読み込む
            if (appPath.BackgroundPath != null && File.Exists(appPath.BackgroundPath))
            {
                DashboardParam.BackgroundPath = appPath.BackgroundPath;
                ChangeBg(Path.GetFullPath(DashboardParam.BackgroundPath));
            }

            if (appPath.ApplicationPath != null && Directory.Exists(appPath.ApplicationPath))
            {
                DashboardParam.ApplicaitonPath = appPath.ApplicationPath;
                Reload();
            }
        }
Esempio n. 3
0
        public Setting()
        {
            InitializeComponent();
            Roaming  = ApplicationUtility.GetUserAppDataPath();
            winboard = Roaming + @"\WinBoard";
            config   = winboard + @"\config.json";
            AppPath appPath = new AppPath();

            //WinBoardフォルダがなかったら作る
            if (!Directory.Exists(winboard))
            {
                MessageBox.Show("WinBoardフォルダが見つかりませんでした\n" + "ファルダを自動作成します");
                Directory.CreateDirectory(winboard);
            }

            //Configがなかったら作る
            if (!File.Exists(config))
            {
                MessageBox.Show("config.jsonファイルが見つかりませんでした\n" + "ファイルを自動作成します");
                var fs = File.Create(config);
                //appPath.ApplicationPath = pathText.Text;
                //appPath.BackgroundPath = backgroundPath.Text;
                //var json = JsonConvert.SerializeObject(appPath);
                //using (var sw = new StreamWriter(@"./Resources/config.json", false, System.Text.Encoding.UTF8))
                //{
                //    sw.Write(json);
                //}
            }
            else
            {
                using (var sr = new StreamReader(System.IO.Path.GetFullPath(config), System.Text.Encoding.UTF8))
                {
                    var json = sr.ReadToEnd();
                    appPath = JsonConvert.DeserializeObject <AppPath>(json);
                }

                if (appPath.ApplicationPath != null && Directory.Exists(appPath.ApplicationPath))
                {
                    pathText.Text = appPath.ApplicationPath;
                }
                if (appPath.BackgroundPath != null && File.Exists(appPath.BackgroundPath))
                {
                    backgroundPath.Text = appPath.BackgroundPath;
                }
                r_SearchColor.Text = appPath.r_SearchColor.ToString();
                g_SearchColor.Text = appPath.g_SearchColor.ToString();
                b_SearchColor.Text = appPath.b_SearchColor.ToString();
            }
        }