Example #1
0
        // 選擇Favorite
        private void Favorite_Click(object sender, RoutedEventArgs e)
        {
            GloableObject.mainWin.preview_mode.IsChecked    = false;
            GloableObject.mainWin.targetFolder_path.Text    = this.favorite_path.Text;
            GloableObject.mainWin.targetFolder_path.ToolTip = this.favorite_path.Text;
            GloableObject.curPath = this.favorite_path.Text;
            GloableObject.random_image(GloableObject.curPath);
            Properties.Settings.Default.Current_Favorite = this.favorite_aka.Text;

            // 控件

            GloableObject.mainWin.control_panel.Children.Clear();

            foreach (string name in Properties.Settings.Default.Favorite_Controls_List)
            {
                string[] ary = name.Split(':', '"');
                string   key = ary[1].ToString();
                // 解第一層dict
                if (key == this.favorite_aka.Text)
                {
                    // {"favorite_name":{"control_x":["color","aka","paht"], "control_x":["color","aka","paht"]}}
                    Dictionary <string, Dictionary <string, List <string> > > favorite_controls_list = (Dictionary <string, Dictionary <string, List <string> > >)JsonConvert.DeserializeObject(name, typeof(Dictionary <string, Dictionary <string, List <string> > >));
                    // "{control_x":["color","aka","paht"], "control_x":["color","aka","paht"]}
                    Dictionary <string, List <string> > controls = favorite_controls_list[key];
                    foreach (string control in controls.Keys)
                    {
                        List <string>  data           = controls[control];
                        Folder_Control folder_control = new Folder_Control();
                        // 顏色
                        BrushConverter tagColor = new BrushConverter(); // 轉換顏色
                        folder_control.colorTag.Background = (Brush)tagColor.ConvertFrom(data[0]);
                        // aka
                        folder_control.akaLabel.Text = data[1];
                        // path
                        folder_control.folderPath.Text  = data[2];
                        folder_control.akaLabel.ToolTip = data[2];
                        folder_control.Height           = 25;
                        GloableObject.mainWin.control_panel.Children.Add(folder_control);
                    }
                }
            }
            GloableObject.folderInfo();
            GloableObject.logger($"✔🔄 [Switch Favorite] - Switch to Favorite {this.favorite_aka.Text}", "HighLight");
            Window.GetWindow(this.Parent).Close();
        }
Example #2
0
        // 確認創建
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            string color = choossColorBtn.SelectedColorText;

            if (color == string.Empty)
            {
                color = "#FFFFFF";
            }

            Folder_Control folder_control = new Folder_Control();                    // 創建 Folder_Control 實例
            BrushConverter tagColor       = new BrushConverter();                    // 轉換顏色

            folder_control.colorTag.Background = (Brush)tagColor.ConvertFrom(color); // 設定Lable控件 colorTag 的顏色

            if (folderAKA_label.Text == string.Empty || folderAKA_label.Text == "A.K.A")
            {
                Console.WriteLine("00");
                if (choseFolder_path.Text != string.Empty)
                {
                    string dirName = new DirectoryInfo(@choseFolder_path.Text).Name;
                    folder_control.akaLabel.Text       = dirName;
                    folder_control.akaLabel.Foreground = Brushes.Gray;
                    Console.WriteLine("0");
                }
            }
            else
            {
                Console.WriteLine("1");
                folder_control.akaLabel.Text = folderAKA_label.Text;
            }
            folder_control.folderPath.Text     = choseFolder_path.Text;
            folder_control.ToolTip             = choseFolder_path.Text;
            folder_control.akaLabel.FontFamily = new FontFamily("Consolas Bold");
            folder_control.Height = 25;
            //將Folder_Control 實例 添加到 MainWindow 的 control_panel 中
            GloableObject.mainWin.control_panel.Children.Add(folder_control);
            GloableObject.logger($"✔🕹[Create Target Folder Control] AKA :[{folderAKA_label.Text}] ; Path: [{choseFolder_path.Text}]");
            // 清空此Dialog元件的所有訊息
            folderAKA_label.Text         = string.Empty;
            choseFolder_path.Text        = string.Empty;
            choossColorBtn.SelectedColor = Color.FromRgb(255, 255, 255);
        }