Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.Manual;
            this.Left          = -99999;

            mainForm = this;
            ListenToParent(); //stdin listen pipe.

            CommandLine.Parser.Default.ParseArguments <Options>(args)
            .WithParsed(RunOptions)
            .WithNotParsed(HandleParseError);

            if (enableCSCore)
            {
                CSCoreInit();        //audio analyser
                //timer, audio sends audio data etc
                timer.Interval = 33; //30fps
                timer.Tick    += Timer_Tick1;
                timer.Start();
            }

            try
            {
                WidgetData.LoadLivelyProperties(livelyPropertyPath);
            }
            catch
            {
                //can be non-customisable wp, file missing/corrupt error: skip.
            }
            InitializeChromium();
        }
Exemplo n.º 2
0
 private void SettingsWidget_Load(object sender, EventArgs e)
 {
     try
     {
         WidgetData.LoadLivelyProperties(Path.Combine(Path.GetDirectoryName(Form1.htmlPath), "LivelyProperties.json"));
         GenerateLivelyWidgetUIElements();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Something went wrong..", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
Exemplo n.º 3
0
 private void SettingsWidget_Load(object sender, EventArgs e)
 {
     try
     {
         WidgetData.LoadLivelyProperties(Form1.livelyPropertyPath);
         GenerateLivelyWidgetUIElements();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Lively:Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();
            mainForm = this;
            ListenToParent();                      //stdin listen pipe.

            if (args.Length == 3)                  //args[0] = application.exe
            {
                if (String.IsNullOrEmpty(args[1])) //url
                {
                    if (Application.MessageLoop)
                    {
                        Application.Exit();
                    }
                    else
                    {
                        Environment.Exit(1); //if msgloop not ready
                    }
                }
                else if (String.IsNullOrEmpty(args[2])) //local-file/online-url flag
                {
                    if (Application.MessageLoop)
                    {
                        Application.Exit();
                    }
                    else
                    {
                        Environment.Exit(1);
                    }
                }
            }
            else if (args.Length == 4)
            {
                if (String.IsNullOrEmpty(args[3])) //audio visualiser flag
                {
                    if (Application.MessageLoop)
                    {
                        Application.Exit();
                    }
                    else
                    {
                        Environment.Exit(1); //if msgloop not ready
                    }
                }
                else if (String.Equals("audio", args[3], StringComparison.InvariantCultureIgnoreCase))
                {
                    enableCSCore = true;
                }
            }
            else
            {
                if (Application.MessageLoop)
                {
                    Application.Exit();
                }
                else
                {
                    Environment.Exit(1);
                }
            }
            path        = args[1];
            htmlPath    = path;
            originalUrl = args[1];

            if (enableCSCore)
            {
                CSCoreInit();        //audio analyser
                //timer, audio sends audio data etc
                timer.Interval = 33; //30fps
                timer.Tick    += Timer_Tick1;
                timer.Start();
            }

            if (args[2] == "local")
            {
                linkType = LinkType.local;
            }
            else if (args[2] == "online")
            {
                if (path.Contains("shadertoy.com/view"))
                {
                    linkType = LinkType.shadertoy;
                }
                else
                {
                    linkType = LinkType.online;
                }
            }
            else if (args[2] == "deviantart")
            {
                linkType = LinkType.deviantart;

                this.FormBorderStyle = FormBorderStyle.Sizable;
                this.WindowState     = FormWindowState.Maximized;
                //this.SizeGripStyle = SizeGripStyle.Show;
                this.ShowInTaskbar = true;
                this.MaximizeBox   = true;
                this.MinimizeBox   = true;
            }

            try
            {
                WidgetData.LoadLivelyProperties(Path.Combine(Path.GetDirectoryName(Form1.htmlPath), "LivelyProperties.json"));
            }
            catch
            {
                //can be non-customisable wp, file missing/corrupt error: skip.
            }

            InitializeChromium();
        }