Ejemplo n.º 1
0
        void AddEvent(Event e, bool select = false)
        {
            Controls.Event ev = CreateEvent(e);

            var event_bt = new Controls.EventButton();

            event_bt.EventName       = String_Functions.UppercaseFirst(e.name.Replace('_', ' '));
            event_bt.SettingChanged += event_bt_SettingChanged;
            event_bt.RemoveClicked  += Event_RemoveClicked;
            event_bt.ParentEvent     = e;

            var bt = new TrakHound_UI.CollapseButton();

            bt.ButtonContent = event_bt;

            if (select)
            {
                event_bt.eventname_TXT.Focus();

                foreach (var obt in EventButtons)
                {
                    obt.IsExpanded = false;
                }
                bt.IsExpanded = true;
            }

            bt.PageContent = ev;

            events.Add(ev);

            EventButtons.Add(bt);
        }
Ejemplo n.º 2
0
        public void Login(ServerCredentials.LoginData loginData)
        {
            UserConfiguration userConfig = null;

            if (loginData != null)
            {
                while (loginData != null && userConfig == null)
                {
                    userConfig = UserManagement.TokenLogin(loginData.Token);
                    if (userConfig == null)
                    {
                        logger.Warn(String_Functions.UppercaseFirst(loginData.Username) + " Failed to Login... Retrying in 5 seconds");

                        Thread.Sleep(5000);

                        loginData = ServerCredentials.Read();
                    }
                }

                if (userConfig != null)
                {
                    logger.Info(String_Functions.UppercaseFirst(userConfig.Username) + " Logged in Successfully");
                }
            }

            CurrentUser = userConfig;
        }
Ejemplo n.º 3
0
        public void SaveConfiguration(DataTable dt)
        {
            string prefix = "/GeneratedData/SnapShotData/";

            // Clear all snapshot rows first (so that Ids can be sequentially assigned)
            DataTable_Functions.TrakHound.DeleteRows(prefix + "*", "address", dt);

            // Loop through SnapshotItems and add each item back to table with sequential id's
            foreach (var item in SnapshotItems)
            {
                if (item.ParentSnapshot != null)
                {
                    var snapshot = item.ParentSnapshot;

                    if (snapshot.Name != null && snapshot.Link != null)
                    {
                        string adr = "/GeneratedData/SnapShotData/" + String_Functions.UppercaseFirst(snapshot.Type.ToString().ToLower());
                        int    id  = DataTable_Functions.TrakHound.GetUnusedAddressId(adr, dt);
                        adr = adr + "||" + id.ToString("00");

                        string attr = "";
                        attr += "id||" + id.ToString("00") + ";";
                        attr += "name||" + snapshot.Name + ";";

                        string link = snapshot.Link;

                        attr += "link||" + link + ";";

                        DataTable_Functions.UpdateTableValue(dt, "address", adr, "attributes", attr);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Login(UserConfiguration userConfig)
        {
            CurrentUser = userConfig;

            if (userConfig != null)
            {
                logger.Info(String_Functions.UppercaseFirst(userConfig.Username) + " Logged in Successfully");
            }
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                string val = value.ToString();

                return(String_Functions.UppercaseFirst(val));
            }

            return(null);
        }
Ejemplo n.º 6
0
 private string GetFormattedValue(string s)
 {
     if (!string.IsNullOrEmpty(s))
     {
         return(String_Functions.UppercaseFirst(s.Replace('_', ' ')));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 7
0
        private void ProcessGeneratedEvents(EventData data)
        {
            var gEventItems = (List <GeneratedEvent>)data.Data02;

            gEventItems = gEventItems.OrderBy(o => o.CurrentValue.Timestamp).ToList();

            var pc = Configuration.Get(configuration);

            if (pc != null)
            {
                var infos = new List <PartInfo>();

                foreach (var partCountEvent in pc.Events)
                {
                    var matchedItems = gEventItems.FindAll(x => x.EventName == partCountEvent.EventName && x.CurrentValue != null && x.PreviousValue != null);
                    foreach (var gEvent in matchedItems)
                    {
                        // Test if current event value matches configured EventName
                        if (gEvent.CurrentValue != null && gEvent.CurrentValue.Value == String_Functions.UppercaseFirst(partCountEvent.EventValue.Replace('_', ' ')))
                        {
                            bool match = true;

                            // Test if previous event value matches configured PreviousEventName
                            if (!string.IsNullOrEmpty(partCountEvent.PreviousEventValue))
                            {
                                match = gEvent.PreviousValue.Value == String_Functions.UppercaseFirst(partCountEvent.PreviousEventValue.Replace('_', ' '));
                            }

                            if (match)
                            {
                                lock (_lock)
                                {
                                    var partInfo = PartInfo.Process(partCountEvent, gEvent, lastSequence);
                                    if (partInfo != null)
                                    {
                                        infos.Add(partInfo);

                                        lastSequence = partInfo.Sequence;
                                        SaveStoredSequence(configuration, lastSequence);
                                    }
                                }
                            }
                        }
                    }

                    if (infos.Count > 0)
                    {
                        SendPartInfos(infos);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void Login(string username, string password)
        {
            Loading        = true;
            LoadingMessage = String_Functions.UppercaseFirst(username);
            LoginError     = false;

            Login_Info info = new Login_Info();

            info.Username = username;
            info.Password = password;

            ThreadPool.QueueUserWorkItem(new WaitCallback(Login_Worker), info);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Convert from 'first_second_third' to 'FirstSecondThird'
        /// </summary>
        /// <param name="var"></param>
        /// <returns></returns>
        private static string FromJsonVariable(string var)
        {
            var builder = new StringBuilder();

            string[] words = var.Split('_');

            string s;

            foreach (string word in words)
            {
                s = String_Functions.UppercaseFirst(word);
                builder.Append(s);
            }

            return(builder.ToString());
        }
        public void LoadUserConfiguration(UserConfiguration userConfig)
        {
            CurrentUser = userConfig;

            profileImageLoaded = false;

            SetPageType(userConfig);

            if (userConfig != null)
            {
                UsernameVerified = true;

                FirstName = String_Functions.UppercaseFirst(userConfig.FirstName);
                LastName  = String_Functions.UppercaseFirst(userConfig.LastName);

                Username = String_Functions.UppercaseFirst(userConfig.Username);
                Email    = userConfig.Email;

                Company  = String_Functions.UppercaseFirst(userConfig.Company);
                Phone    = userConfig.Phone;
                Address1 = userConfig.Address1;
                Address2 = userConfig.Address2;
                City     = userConfig.City;
                ZipCode  = userConfig.Zipcode;

                int country = CountryList.ToList().FindIndex(x => x == String_Functions.UppercaseFirst(userConfig.Country));
                if (country >= 0)
                {
                    country_COMBO.SelectedIndex = country;
                }

                int state = CountryList.ToList().FindIndex(x => x == String_Functions.UppercaseFirst(userConfig.State));
                if (state >= 0)
                {
                    state_COMBO.SelectedIndex = state;
                }

                LoadProfileImage(userConfig);
            }
            else
            {
                CleanForm();
            }
        }
Ejemplo n.º 11
0
        Controls.CaptureItem CreateCaptureItem(CaptureItem ci, Event e)
        {
            Controls.CaptureItem result = new Controls.CaptureItem();

            result.ParentPage        = this;
            result.ParentEvent       = e;
            result.ParentCaptureItem = ci;

            result.SettingChanged += CaptureItem_SettingChanged;
            result.RemoveClicked  += CaptureItem_RemoveClicked;

            if (ci.name != null)
            {
                result.CaptureName = String_Functions.UppercaseFirst(ci.name.Replace('_', ' '));
            }

            result.link_COMBO.Text = ci.link;

            return(result);
        }
Ejemplo n.º 12
0
 public GeneratedEventItem(TrakHound_Dashboard.Pages.DeviceManager.Pages.GeneratedEvents.Page.Event e)
 {
     Id    = e.name;
     Name  = String_Functions.UppercaseFirst(e.name.Replace('_', ' ').ToLower());
     Event = e;
 }
 public CaptureItem(GeneratedEvents.Page.CaptureItem item)
 {
     Id   = item.name;
     Name = String_Functions.UppercaseFirst(item.name.Replace('_', ' '));
 }
Ejemplo n.º 14
0
 public GeneratedEventItem(GeneratedEvents.Page.Event e)
 {
     Id    = e.name;
     Name  = String_Functions.UppercaseFirst(e.name.Replace('_', ' ').ToLower());
     Event = e;
 }
Ejemplo n.º 15
0
 public override string ToString()
 {
     return(String_Functions.UppercaseFirst(name.Replace('_', ' ')));
 }