コード例 #1
0
ファイル: SettingsWidget.cs プロジェクト: Tanuki33/lively-cef
 private void PictureBox_Clicked(object sender, EventArgs e)
 {
     try
     {
         var         item        = (PictureBox)sender;
         ColorDialog colorDialog = new ColorDialog()
         {
             AllowFullOpen = true
         };
         if (colorDialog.ShowDialog() == DialogResult.OK)
         {
             item.BackColor = colorDialog.Color;
             if (Form1.chromeBrowser.CanExecuteJavascriptInMainFrame)
             {
                 Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, ToHexValue(colorDialog.Color));
                 WidgetData.liveyPropertiesData[item.Name]["value"] = ToHexValue(colorDialog.Color);
                 WidgetData.SaveLivelyProperties(propertyFilePath, WidgetData.liveyPropertiesData);
             }
         }
     }
     catch (Exception ex) //saving error
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
        private void DefaultBtn_Click(object sender, EventArgs e)
        {
            try
            {
                WidgetData.LoadLivelyProperties(Path.Combine(Path.GetDirectoryName(Form1.htmlPath), "LivelyProperties.json"));
                WidgetData.SaveLivelyProperties(Form1.livelyPropertyPath, WidgetData.liveyPropertiesData);

                LivelyPropertiesDataReload();
                Form1.SettingsWidgetReload();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Lively:Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
ファイル: SettingsWidget.cs プロジェクト: Tanuki33/lively-cef
 private void Textbox_TextChanged(object sender, EventArgs e)
 {
     try
     {
         var item = (TextBox)sender;
         //Debug.WriteLine(item.Name + " "+item.Text);
         if (Form1.chromeBrowser.CanExecuteJavascriptInMainFrame)
         {
             Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, item.Text);
             WidgetData.liveyPropertiesData[item.Name]["value"] = item.Text;
             WidgetData.SaveLivelyProperties(propertyFilePath, WidgetData.liveyPropertiesData);
         }
     }
     catch (Exception ex) //saving error
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #4
0
 private void Button_Click(object sender, EventArgs e)
 {
     try
     {
         var item = (Button)sender;
         //Debug.WriteLine(item.Name);
         if (Form1.chromeBrowser.CanExecuteJavascriptInMainFrame)
         {
             Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, true);
             WidgetData.liveyPropertiesData[item.Name]["value"] = true;
             WidgetData.SaveLivelyProperties(Form1.livelyPropertyPath, WidgetData.liveyPropertiesData);
         }
     }
     catch (Exception ex) //saving error
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
 private void CmbBox_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         var item = (ComboBox)sender;
         //Debug.WriteLine(item.Name + item.SelectedIndex);
         if (Form1.chromeBrowser.CanExecuteJavascriptInMainFrame)
         {
             Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, item.SelectedIndex);
             WidgetData.liveyPropertiesData[item.Name]["value"] = item.SelectedIndex;
             WidgetData.SaveLivelyProperties(Form1.livelyPropertyPath, WidgetData.liveyPropertiesData);
         }
     }
     catch (Exception ex) //saving error
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #6
0
        private void FolderCmbBox_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                var item = (ComboBox)sender;
                if (Form1.chromeBrowser.CanExecuteJavascriptInMainFrame)
                {
                    var filePath = Path.Combine(WidgetData.liveyPropertiesData[item.Name]["folder"].ToString(), item.GetItemText(item.SelectedItem));  //filename is unique.

                    Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, filePath);
                    WidgetData.liveyPropertiesData[item.Name]["value"] = item.GetItemText(item.SelectedItem);
                    WidgetData.SaveLivelyProperties(Form1.livelyPropertyPath, WidgetData.liveyPropertiesData);
                }
            }
            catch (Exception ex) //saving error?
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #7
0
        private void Trackbar_Scroll(object sender, EventArgs e)
        {
            try
            {
                var item = (TrackBar)sender;
                //label with trackbar value.
                var lbl = (Label)uiElement[uiElement.FindIndex(x => x.Equals(sender)) + 1];
                lbl.Text = item.Value.ToString();

                if (Form1.chromeBrowser.CanExecuteJavascriptInMainFrame)
                {
                    Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, item.Value);
                    WidgetData.liveyPropertiesData[item.Name]["value"] = item.Value;
                    WidgetData.SaveLivelyProperties(Form1.livelyPropertyPath, WidgetData.liveyPropertiesData);
                }
            }
            catch (Exception ex) //saving error
            {
                MessageBox.Show(ex.Message);
            }
        }