Exemplo n.º 1
0
 void zvsEntityControl_SceneRunStartedEvent(scene s, string result)
 {
     if (this.InvokeRequired)
         this.Invoke(new zvsEntityControl.SceneRunStartedEventHandler(zvsEntityControl_SceneRunStartedEvent), new object[] { s, result });
     else
     {
         if (s != null)
         {
             Logger.WriteToLog(Urgency.INFO, result, "EVENT");
             SyncdataListViewScenes();
         }
     }
 }
Exemplo n.º 2
0
 void zvsEntityControl_SceneRunStartedEvent(scene s, string result)
 {
 }
Exemplo n.º 3
0
        private void duplicateSceneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            scene selected_scene = (scene)dataListViewScenes.SelectedObject;
            if (selected_scene != null)
            {
                scene new_scene = new scene { friendly_name = selected_scene.friendly_name + " Copy", sort_order = dataListViewScenes.GetItemCount() + 1 };

                using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
                {
                    selected_scene = db.scenes.FirstOrDefault(s => s.id == selected_scene.id);
                    if (selected_scene != null)
                    {
                        foreach (scene_commands sc in selected_scene.scene_commands)
                        {
                            new_scene.scene_commands.Add(new scene_commands
                            {
                                arg = sc.arg,
                                command_id = sc.command_id,
                                command_type_id = sc.command_type_id,
                                sort_order = sc.sort_order,
                                device_id = sc.device_id
                            });
                        }
                    }

                    db.scenes.AddObject(new_scene);
                    db.SaveChanges();
                }
                zvsEntityControl.CallSceneModified(this, selected_scene.id);
            }
        }
Exemplo n.º 4
0
        private void AddScene()
        {
            scene new_s = new scene { friendly_name = "New Scene", sort_order = dataListViewScenes.GetItemCount() + 1 };
            using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
            {
                db.scenes.AddObject(new_s);
                db.SaveChanges();

                //todo: might case concurency issues
                zvsEntityControl.CallSceneModified(this, new_s.id);
            }
        }
        private void CreateDynamicProperties(scene scene, zvsEntities2 db)
        {
            pnlSceneProperties.Controls.Clear();
            int top = 0;

            #region Properties
            top += 10;
            foreach (scene_property property in db.scene_property)
            {
                int left = 0;

                //Get Value
                string value = string.Empty;
                if (scene.scene_property_value.Any(sp => sp.scene_property_id == property.id))
                {
                    value = scene.scene_property_value.FirstOrDefault(sp => sp.scene_property_id == property.id).value;
                }
                else
                {
                    value = property.defualt_value;
                }

                #region Input Boxes
                left = GlobalMethods.DrawDynamicUserInputBoxes(pnlSceneProperties,
                                                                (Data_Types)property.value_data_type,
                                                                top,
                                                                left,
                                                                property.id + "-proparg",
                                                                property.friendly_name,
                                                                property.scene_property_option.Select(o=> o.option).ToList(),
                                                                value,
                                                                "");

                #endregion

                #region Add Button
                Button btn = new Button();
                btn.Name = property.friendly_name;
                btn.Text = ((Data_Types)property.value_data_type == Data_Types.NONE ? "" : "Save ") + property.friendly_name;
                btn.Click += new EventHandler(btn_Click_Property_Set);
                btn.Tag = property;
                btn.Top = top;
                btn.Left = left;
                pnlSceneProperties.Controls.Add(btn);

                using (Graphics cg = this.CreateGraphics())
                {
                    SizeF size = cg.MeasureString(btn.Text, btn.Font);
                    size.Width += 10; //add some padding
                    btn.Width = (int)size.Width;
                    left = (int)size.Width + left + 5;
                }
                #endregion

                #region Add Description
                Label lbl = new Label();
                lbl.Text = property.description;
                lbl.Top = top +4;
                lbl.Left = left;
                lbl.AutoSize = false;
                pnlSceneProperties.Controls.Add(lbl);

                using (Graphics cg = this.CreateGraphics())
                {
                    SizeF size = cg.MeasureString(lbl.Text, lbl.Font);
                    size.Width += 10; //add some padding
                    lbl.Width = (int)size.Width;
                    left = (int)size.Width + left + 5;
                }
                #endregion

                top += 35;
            }
            #endregion
        }
 void zvsEntityControl_SceneRunStartedEvent(scene s, string result)
 {
     this.BroadcastEvent("SceneRunStarted", s.id.ToString());
 }
Exemplo n.º 7
0
 public static void SceneRunStarted(scene s, string result)
 {
     if (SceneRunStartedEvent != null)
         SceneRunStartedEvent(s, result);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the scenes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToscenes(scene scene)
 {
     base.AddObject("scenes", scene);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Create a new scene object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="is_running">Initial value of the is_running property.</param>
 public static scene Createscene(global::System.Int64 id, global::System.Boolean is_running)
 {
     scene scene = new scene();
     scene.id = id;
     scene.is_running = is_running;
     return scene;
 }