Exemplo n.º 1
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         string    strJSON = File.ReadAllText(openFileDialog1.FileName);
         PKBoxItem item    = PKStorage.Deserialize(strJSON);
         pkExtDesigner.SetAppPage(item as PKControl);
     }
 }
Exemplo n.º 2
0
 private void CopySelected()
 {
     Clipboard.Clear();
     if (pkExtDesigner.SelectedItem != null)
     {
         string tempObject = PKStorage.Serialize(pkExtDesigner.SelectedItem);
         Clipboard.SetText(tempObject);
     }
 }
Exemplo n.º 3
0
 private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (this.ControlSelected != null && listView1.SelectedItems.Count > 0)
     {
         var selectedControl = listView1.SelectedItems[0].Tag as PKControl;
         var copyControl     = PKStorage.Deserialize(PKStorage.Serialize(selectedControl)) as PKControl;
         copyControl.IsComponent       = true;
         copyControl.ComponentFileName = selectedControl.ComponentFileName;
         this.ControlSelected(copyControl);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 public void Checkpoint()
 {
     if (!working)
     {
         string str = PKStorage.Serialize(currentPage.AppPage);
         if (str != lastState)
         {
             undoBuffers.Push(str);
             lastState = str;
         }
     }
 }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                PKControl cmp = this.pkExtDesigner.AppPage;
                //cmp.ComponentFileName = Path.GetFileName(saveFileDialog1.FileName);
                //cmp.IsComponent = true;
                string strJSON = PKStorage.Serialize(cmp);

                File.WriteAllText(saveFileDialog1.FileName, strJSON);
            }
        }
Exemplo n.º 6
0
        void bWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var userControls = new List <PKControl>();
            var list         = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Components"));

            list.ToList().ForEach(file => {
                string str  = File.ReadAllText(file);
                var control = PKStorage.DeserializeComponent(str);
                control.ComponentFileName = Path.GetFileName(file);
                userControls.Add(control);
            });
            e.Result = userControls;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Ctrl - Y
 /// </summary>
 public void ReDo()
 {
     working = true;
     if (redoBuffers.Count > 0)
     {
         string str = redoBuffers.Pop();
         if (str != null)
         {
             currentPage.SetAppPage(PKStorage.Deserialize(str) as PKControl);
             undoBuffers.Push(str);
         }
     }
     working = false;
 }
Exemplo n.º 8
0
 private void PasteSelected()
 {
     try
     {
         string tempObject = Clipboard.GetText();
         if (tempObject != null)
         {
             PKBoxItem obj = PKStorage.Deserialize(tempObject, true);
             pkExtDesigner.AddItem(obj);
         }
     }
     catch
     {
     }
 }