コード例 #1
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);
            // If the DataObject contains string data, extract it.
            ConfigList par = this.Parent as ConfigList;

            if (e.Data.GetDataPresent("Object") &&
                par != null)
            {
                Object data_obj = (Object)e.Data.GetData("Object");
                List <LinuxTreeViewItem> list_ltvi = data_obj as List <LinuxTreeViewItem>;
                if (list_ltvi != null)
                {
                    foreach (LinuxTreeViewItem ltvi in list_ltvi)
                    {
                        if (this.work_name != null && this.index == null)
                        {
                            JObject jobj;
                            if (this.root["type"].ToString() == "file")
                            {
                                jobj = new JObject(new JProperty("enc_option", new JObject(new JProperty("input_dir", ltvi.Path))));
                            }
                            else
                            {
                                jobj = new JObject(new JProperty("comm_option", new JObject(new JProperty("input_dir", ltvi.Path))));
                            }

                            if (jobj != null)
                            {
                                JObject tmp_root = this.root.DeepClone() as JObject;
                                (tmp_root?["work_group"]?[work_name]?["processes"] as JArray)?.Add(jobj);
                                string tmp_index = this.Items.Count.ToString();

                                Window_Config wc = new Window_Config(tmp_root, this.work_name, tmp_index, true, ltvi.Path);
                                Point         pt = WindowMain.current.PointToScreen(new Point(WindowMain.current.Width - wc.Width, WindowMain.current.Height - wc.Height));
                                wc.Left = pt.X;
                                wc.Top  = pt.Y;
                                bool?retval = wc.ShowDialog();
                                if (retval == true)
                                {
                                    if (ltvi.IsDirectory)
                                    {
                                        (this.root?["work_group"]?[work_name]?["processes"] as JArray)?.Add(jobj);
                                        this.Items.Add(new ConfigInfoPanel(this.bnt_parent, this.root, this.work_name, tmp_index, ltvi.Path));
                                    }
                                    /* 암호화 */
                                    Console.WriteLine("JHLIM_DEBUG : Encrypt {0} {1} {2} [{3}]", this.root["type"], this.work_name, tmp_index, ltvi.Path);
                                }
                            }
                        }
                        else if (this.work_name != null && this.index != null)
                        {
                            ;
                        }
                    }
                }
            }
        }
コード例 #2
0
        public ConfigMenuButton(ConfigPanel _pan_parent, JObject _Root, string header)
        {
            this.pan_parent = _pan_parent;
            Root            = _Root;
            this.InitStyle();

            this.Content = header;
            //this.Background = Brushes.White;
            this.Height = HEIGHT;
            this.HorizontalAlignment = HorizontalAlignment.Stretch;
            this.VerticalAlignment   = VerticalAlignment.Bottom;
            this.FontSize            = FONTSIZE;

            this.child                   = new ConfigList();
            this.child.Visibility        = Visibility.Collapsed;
            this.child.VerticalAlignment = VerticalAlignment.Top;
            this.child.parent            = this;

            this.pan_parent?.btn_group.Add(this);
            if (this.pan_parent != null)
            {
                for (int i = 0; i < this.pan_parent.btn_group.Count; i++)
                {
                    this.pan_parent.btn_group[i].Margin = new Thickness(0, i * HEIGHT, 0, (this.pan_parent.btn_group.Count - (i + 1)) * HEIGHT);
                }
            }

            AddConfigWorkGroupCommand = new RelayCommand(AddConfigWorkGroup);
            this.ContextMenu          = new ContextMenu();
            MenuItem item;

            item         = new MenuItem();
            item.Command = AddConfigWorkGroupCommand;
            item.Header  = "Add Config Work Group";
            item.Icon    = new PackIconMaterial()
            {
                Kind = PackIconMaterialKind.FolderPlus,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            };
            this.ContextMenu.Items.Add(item);
        }