Exemple #1
0
        public CRUDGeneral()
        {
            InitializeComponent();
            buildQuery();
            TabAction disableUpdate = new TabAction(() => {
                btnUpdate.Enabled = false;
            });
            TabAction enabledUpdate = new TabAction(() => {
                btnUpdate.Enabled = true;
            });

            tab_table.Add(tabToko, "toko");
            tab_table.Add(tabKaryawan, "karyawan");
            tab_table.Add(tabBarang, "barang");
            tab_table.Add(tabDistributor, "distributor");
            tab_table.Add(tabBarangDistributor, "distributor_barang");
            tab_table.Add(tabTokoMenjual, "toko_menjual");

            tab_action.Add(tabToko, enabledUpdate);
            tab_action.Add(tabKaryawan, enabledUpdate);
            tab_action.Add(tabBarang, enabledUpdate);
            tab_action.Add(tabDistributor, enabledUpdate);
            tab_action.Add(tabBarangDistributor, disableUpdate);
            tab_action.Add(tabTokoMenjual, disableUpdate);
            view      = new DataView();
            view.crud = this;
            //           view.MdiParent = this;
            view.Show();
            form_close        = new System.Windows.Forms.FormClosingEventHandler(this.exit);
            this.FormClosing += form_close;
            read(null, null);
        }
Exemple #2
0
		public static void SendToPeepers(GameObject provider, NetTabType type, TabAction tabAction, ElementValue[] values = null)
		{
			//Notify all peeping players of the change
			var list = NetworkTabManager.Instance.GetPeepers(provider, type);
			foreach (var connectedPlayer in list)
			{
				Send(connectedPlayer.GameObject, provider, type, tabAction, null, values);
			}
		}
Exemple #3
0
        public void CallTabAction(TabAction action)
        {
            switch (action.ActionType)
            {
            case TabActionType.Edit:
                EditTimelineTabCommand.Execute(action.Parameter as TimelineTab);
                break;

            case TabActionType.Delete:
                DeleteTimelineTabCommand.Execute(action.Parameter as TimelineTab);
                break;
            }
        }
    public static void SendToPeepers(GameObject provider, NetTabType type, TabAction tabAction,
                                     ElementValue[] values = null)
    {
        //Notify all peeping players of the change
        List <ConnectedPlayer> list = NetworkTabManager.Instance.GetPeepers(provider, type);

//		TabUpdateMessage logMessage = null;
        for (var i = 0; i < list.Count; i++)
        {
            var connectedPlayer = list[i];
//			logMessage =
            Send(connectedPlayer.GameObject, provider, type, tabAction, null, values);
        }
//		if ( logMessage != null ) {
//			Logger.Log( $"Sending {logMessage}" );
//		}
    }
Exemple #5
0
        private void ToggleExtendedTaskTabs(TabAction tabAction)
        {
            switch (tabAction)
            {
            case TabAction.Remove:
                SafelyRemoveTab(this.DemographicsTaskTab);
                SafelyRemoveTab(this.ImpRecogTaskTab);
                SafelyRemoveTab(this.ExpRecogTaskTab);
                SafelyRemoveTab(this.LikabilityRatingTab);
                break;

            case TabAction.Add:
                SafelyAddTab(this.DemographicsTaskTab);
                SafelyAddTab(this.ImpRecogTaskTab);
                SafelyAddTab(this.ExpRecogTaskTab);
                SafelyAddTab(this.LikabilityRatingTab);
                break;
            }
        }
    public static TabUpdateMessage Send(GameObject recipient, GameObject provider, NetTabType type, TabAction tabAction, GameObject changedBy = null,
                                        ElementValue[] values = null)
    {
//		if ( changedBy ) {
//			//body = human_33, hands, uniform, suit
//		}
        var msg = new TabUpdateMessage {
            Provider      = provider.NetId(),
            Type          = type,
            Action        = tabAction,
            ElementValues = values,
            Touched       = changedBy != null
        };

        switch (tabAction)
        {
        case TabAction.Open:
            NetworkTabManager.Instance.Add(provider, type, recipient);
            //!! resetting ElementValues
            msg.ElementValues = NetworkTabManager.Instance.Get(provider, type).ElementValues;
            //!!
            break;

        case TabAction.Close:
            NetworkTabManager.Instance.Remove(provider, type, recipient);
            break;

        case TabAction.Update:
            var playerScript = recipient.Player()?.Script;

            //fixme: duplication of NetTab.ValidatePeepers
            //Not sending updates and closing tab for players that don't pass the validation anymore
            bool validate = playerScript && !playerScript.canNotInteract() && playerScript.IsInReach(provider, true);
            if (!validate)
            {
                Send(recipient, provider, type, TabAction.Close);
                return(msg);
            }
            break;
        }
        msg.SendTo(recipient);
        Logger.LogTrace(msg.ToString(), Category.NetUI);
        return(msg);
    }
Exemple #7
0
 public IdeViMode(ExtensibleTextEditor editor, MonoDevelop.Ide.Gui.Document doc) :
     base(doc)
 {
     this.editor = editor;
     tabAction   = new TabAction(editor);
 }
Exemple #8
0
 public static TabUpdateMessage Send(GameObject recipient, GameObject provider, NetTabType type, TabAction tabAction,
                                     GameObject changedBy  = null,
                                     ElementValue[] values = null)
 {
     switch (tabAction)
     {
     case TabAction.Open:
         NetworkTabManager.Instance.Add(provider, type, recipient);
         var instance = NetworkTabManager.Instance.Get(provider, type);
         if (instance == null)
         {
             Logger.LogError($"Couldn't find NetTab to send for {provider.OrNull()?.ExpensiveName()} " +
                             $"Does the tab prefab match the type '{type}'? Make sure that 'Tab{type}' is listed inside the NetTabs SO.");
             return(default);
         }
         values = instance.ElementValues;
         break;
    public static TabUpdateMessage Send(GameObject recipient, GameObject provider, NetTabType type, TabAction tabAction,
                                        GameObject changedBy  = null,
                                        ElementValue[] values = null)
    {
        switch (tabAction)
        {
        case TabAction.Open:
            NetworkTabManager.Instance.Add(provider, type, recipient);
            values = NetworkTabManager.Instance.Get(provider, type).ElementValues;
            break;

        case TabAction.Close:
            NetworkTabManager.Instance.Remove(provider, type, recipient);
            break;

        case TabAction.Update:
            //fixme: duplication of NetTab.ValidatePeepers
            //Not sending updates and closing tab for players that don't pass the validation anymore
            var validate = Validations.CanApply(recipient, provider, NetworkSide.Server);
            if (!validate)
            {
                Send(recipient, provider, type, TabAction.Close);
                return(null);
            }
            break;
        }

        // SingleMessage, MoreIncoming, EndOfMessage
        var id = TabMessageType.SingleMessage;

        Counter++;
        var uniqueID = Counter;

        if (Counter > 10000)
        {
            Counter = 0;
        }

        var elementValuesLists = new Dictionary <List <ElementValue>, TabMessageType>();

        if (values != null && tabAction != TabAction.Close)
        {
            // get max possible packet size from current transform
            var maxPacketSize = Transport.activeTransport.GetMaxPacketSize(0);

            // set currentSize start value to max TCP header size (60b)
            var currentSize = 100;

            //Stores the current cycle of ElementValues
            var elementValues = new List <ElementValue>();

            //How many values are being sent
            var length = values.Length;

            //Total packet size if all values sent together
            var totalSize = 0;

            //Work out totalSize
            foreach (var value in values)
            {
                var size = value.GetSize();

                //If a single value is bigger than max packet size cannot proceed
                if (size + 60 >= maxPacketSize)
                {
                    Debug.LogError($"This value is above the max mirror packet limit, and cannot be split. Is {size + 60} bytes");
                    return(null);
                }

                totalSize += size;
            }

            //Rounds up to the max number of divisions of the max packet size will be needed for values
            var divisions = (int)Math.Ceiling((float)totalSize / maxPacketSize);

            //Counter for which division is currently being made
            var currentDivision = 0;

            //The loop for making the messages from the values
            for (var i = 0; i < length; i++)
            {
                //Keep adding values until bigger than packet size
                currentSize += values[i].GetSize();

                if (currentSize > maxPacketSize)
                {
                    currentDivision++;
                    currentSize = 100;

                    //Id MoreIncoming, means it is a multimessage but not the end.
                    id = TabMessageType.MoreIncoming;

                    //If last division then this will be the end, set to end Id of EndOfMessage
                    if (currentDivision == divisions)
                    {
                        id = TabMessageType.EndOfMessage;
                    }

                    //Add value list to the message list
                    elementValuesLists.Add(elementValues, id);
                    elementValues = new List <ElementValue>();
                }

                elementValues.Add(values[i]);
            }

            //Single message
            if (elementValuesLists.Count == 0)
            {
                values = elementValues.ToArray();
            }
            //Multimessage, if end division hasnt been reached yet then this last list must be end.
            else if (currentDivision != divisions)
            {
                elementValuesLists.Add(elementValues, TabMessageType.EndOfMessage);
            }
        }

        var count = elementValuesLists.Count;

        //Single message
        if (count == 0)
        {
            var msg = new TabUpdateMessage
            {
                Provider      = provider.NetId(),
                Type          = type,
                Action        = tabAction,
                ElementValues = values,
                Touched       = changedBy != null,
                ID            = id,
                UniqueID      = uniqueID
            };

            msg.SendTo(recipient);
            Logger.LogTraceFormat("{0}", Category.NetUI, msg);
            return(null);
        }

        foreach (var value in elementValuesLists)
        {
            var msg = new TabUpdateMessage
            {
                Provider      = provider.NetId(),
                Type          = type,
                Action        = tabAction,
                ElementValues = value.Key.ToArray(),
                Touched       = changedBy != null,
                ID            = value.Value,
                UniqueID      = uniqueID,
                NumOfMessages = count
            };

            msg.SendTo(recipient);
            Logger.LogTraceFormat("{0}", Category.NetUI, msg);
        }

        return(null);
    }
    public static TabUpdateMessage Send(GameObject recipient, GameObject provider, NetTabType type, TabAction tabAction,
                                        GameObject changedBy  = null,
                                        ElementValue[] values = null)
    {
        var msg = new TabUpdateMessage
        {
            Provider      = provider.NetId(),
            Type          = type,
            Action        = tabAction,
            ElementValues = values,
            Touched       = changedBy != null
        };

        switch (tabAction)
        {
        case TabAction.Open:
            NetworkTabManager.Instance.Add(provider, type, recipient);
            //!! resetting ElementValues
            msg.ElementValues = NetworkTabManager.Instance.Get(provider, type).ElementValues;
            //!!
            break;

        case TabAction.Close:
            NetworkTabManager.Instance.Remove(provider, type, recipient);
            break;

        case TabAction.Update:

            //fixme: duplication of NetTab.ValidatePeepers
            //Not sending updates and closing tab for players that don't pass the validation anymore
            var validate = Validations.CanApply(recipient, provider, NetworkSide.Server);
            if (!validate)
            {
                Send(recipient, provider, type, TabAction.Close);
                return(msg);
            }

            break;
        }

        msg.SendTo(recipient);
        Logger.LogTraceFormat("{0}", Category.NetUI, msg);
        return(msg);
    }
Exemple #11
0
 public void CallTabAction(TabAction action)
 {
     switch (action.ActionType)
     {
         case TabActionType.Edit:
             EditTimelineTabCommand.Execute(action.Parameter as TimelineTab);
             break;
         case TabActionType.Delete:
             DeleteTimelineTabCommand.Execute(action.Parameter as TimelineTab);
             break;
     }
 }
Exemple #12
0
 private void ToggleExtendedTaskTabs(TabAction tabAction)
 {
     switch(tabAction)
     {
         case TabAction.Remove:
             SafelyRemoveTab(this.DemographicsTaskTab);
             SafelyRemoveTab(this.ImpRecogTaskTab);
             SafelyRemoveTab(this.ExpRecogTaskTab);
             SafelyRemoveTab(this.LikabilityRatingTab);
             break;
         case TabAction.Add:
             SafelyAddTab(this.DemographicsTaskTab);
             SafelyAddTab(this.ImpRecogTaskTab);
             SafelyAddTab(this.ExpRecogTaskTab);
             SafelyAddTab(this.LikabilityRatingTab);
             break;
     }
 }