Esempio n. 1
0
        public void AddItem(string strCaption)
        {
            try
            {
                objExpanderItem = new CtlExpanderItem();
                objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objExpanderItem.VerticalAlignment   = VerticalAlignment.Stretch;

                objExpanderItem.Image   = "";
                objExpanderItem.Caption = strCaption;

                TreeViewItem objTrviExpanderItem = new TreeViewItem();
                objTrviExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objTrviExpanderItem.VerticalAlignment   = VerticalAlignment.Stretch;

                objTrviExpanderItem.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(objTrviExpanderItem_PreviewMouseLeftButtonDown);
                objTrviExpanderItem.Header = objExpanderItem;

                trvExpanderContent.Items.Add(objTrviExpanderItem);
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "AddItem()", "Controls\\BuddyExplorer\\CtlExpanderContent.xaml.cs");
            }
        }
Esempio n. 2
0
 public void Dispose()
 {
     try
     {
         if (EntItemSelectionChanged != null)
         {
             EntItemSelectionChanged = null;
         }
         if (objExpanderItem != null)
         {
             objExpanderItem = null;
         }
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "Dispose()", "Controls\\BuddyExplorer\\CtlExpanderContent.xaml.cs");
     }
 }
Esempio n. 3
0
        //void mnuViewProfile_Click(object sender, RoutedEventArgs e)
        //{
        //    string buddies = ((MenuItem)sender).Tag.ToString();

        //    //buddies = "123,asd,234,zxcvg,3456,sdfgh,4245,wdfgs,";
        //    buddies = buddies.Substring(0,buddies.LastIndexOf(','));
        //    string buddyProfile = null;
        //    if (buddies.Contains(","))
        //    {
        //         buddyProfile = buddies.Substring(buddies.LastIndexOf(',')+1);
        //    }
        //    else
        //    {
        //        buddyProfile = buddies;
        //    }

        //    int userID = VMukti.Business.clsProfile.GetUserID(buddyProfile);

        //    VMuktiAPI.VMuktiHelper.CallEvent("ViewProfile", null, new VMuktiEventArgs(userID));
        //}

        //void trvExpanderContent_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        //{
        //    try
        //    {
        //        if (this.Tag.ToString() == "BuddyType")
        //        {
        //            if (selectedExItems.Count > 0)
        //            {
        //                ContextMenu cntMenuCollMod = new ContextMenu();

        //                ClsModuleCollection cmc = ClsModuleCollection.GetOnlyCollMod();
        //                for (int i = 0; i < cmc.Count; i++)
        //                {
        //                    MenuItem mnuColl = new MenuItem();
        //                    mnuColl.Header = cmc[i].ModuleTitle;
        //                    mnuColl.Tag = cmc[i].ModuleId;
        //                    mnuColl.Click += new RoutedEventHandler(mnuColl_Click);
        //                    cntMenuCollMod.Items.Add(mnuColl);
        //                }

        //                Separator sp = new Separator();
        //                cntMenuCollMod.Items.Add(sp);

        //                string strBuddiesName = "";
        //                string allBuddies = "";
        //                //((TreeViewItem)((TreeView)sender).SelectedValue).Header
        //                foreach (KeyValuePair<CtlExpanderItem, string> strBName in selectedExItems)
        //                {
        //                    if (((CtlExpanderItem)strBName.Key).Tag.ToString().Trim() == "online")
        //                    {
        //                        strBuddiesName += strBName.Value + ",";
        //                    }
        //                    allBuddies += strBName.Value + ",";
        //                }
        //                if (strBuddiesName == "")
        //                {
        //                    cntMenuCollMod.Items.Clear();
        //                    for (int i = 0; i < cmc.Count; i++)
        //                    {
        //                        MenuItem mnuColl = new MenuItem();
        //                        mnuColl.Header = cmc[i].ModuleTitle;
        //                        mnuColl.Tag = cmc[i].ModuleId;
        //                        mnuColl.IsEnabled = false;
        //                        mnuColl.Click += new RoutedEventHandler(mnuColl_Click);
        //                        cntMenuCollMod.Items.Add(mnuColl);
        //                    }
        //                }
        //                System.Windows.Controls.MenuItem menuItem1;
        //                menuItem1 = new System.Windows.Controls.MenuItem();
        //                menuItem1.Header = "Remove Buddy";
        //                //menuItem1.Tag = ctlItem.Caption;
        //                menuItem1.Click += new RoutedEventHandler(menuItem1_Click);
        //                cntMenuCollMod.Items.Add(menuItem1);

        //                if (VMuktiAPI.VMuktiInfo.CurrentPeer.RoleID == 1)
        //                {
        //                    MenuItem mnuViewLog = new MenuItem();
        //                    mnuViewLog.Header = "View Log";
        //                    mnuViewLog.Click += new RoutedEventHandler(mnuViewLog_Click);
        //                    mnuViewLog.Tag = strBuddiesName;
        //                    cntMenuCollMod.Items.Add(mnuViewLog);
        //                }
        //                MenuItem mnuViewProfile = new MenuItem();
        //                mnuViewProfile.Header = "View Profile";
        //                mnuViewProfile.Click += new RoutedEventHandler(mnuViewProfile_Click);
        //                mnuViewProfile.Tag = allBuddies;
        //                cntMenuCollMod.Items.Add(mnuViewProfile);

        //                trvExpanderContent.ContextMenu = cntMenuCollMod;
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        VMuktiHelper.ExceptionHandler(ex, "trvExpanderContent_PreviewMouseRightButtonDown()", "Controls\\BuddyExplorer\\CtlExpanderContent.xaml.cs");
        //    }
        //}
        #endregion

        #region BuddySingleClick + Widgets

        void objExpanderItem_EntLoadSelectedWid(CtlExpanderItem buddyname, int modid)
        {
            Dictionary <CtlExpanderItem, string> dicttemp = new Dictionary <CtlExpanderItem, string>();

            dicttemp.Add(buddyname, buddyname.Caption);
            if (modid == 999)
            {
                selectedExItems.Add(buddyname, buddyname.Caption);
                this.menuItem1_Click(null, null);
            }
            else
            {
                if (EntCModBuddies != null)
                {
                    EntCModBuddies(dicttemp, modid);
                }
            }
        }
Esempio n. 4
0
        void ctlBuddyGrid_btnAcceptClicked(object sender, RoutedEventArgs e)
        {
            try
            {
                ClsBuddy objBuddy = new ClsBuddy();
                objBuddy.ID       = -1;
                objBuddy.UserID   = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                objBuddy.MyUserID = objBuddyReqCollection[int.Parse(((Button)sender).Tag.ToString())].ReqUserID;
                objBuddy.Save();

                objBuddyReqCollection[int.Parse(((Button)sender).Tag.ToString())].Delete();

                ClsBuddyCollection MyBuddies = ClsBuddyCollection.GetByMyUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (MyBuddies != null)
                {
                    lstBuddies.Items.Clear();
                    for (int i = 0; i < MyBuddies.Count; i++)
                    {
                        CtlExpanderItem objExpanderItem = new CtlExpanderItem();
                        objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                        objExpanderItem.VerticalAlignment   = VerticalAlignment.Stretch;
                        objExpanderItem.Image   = @"\Images\Buddy.Png";
                        objExpanderItem.Caption = MyBuddies[i].DisplayName;

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content   = objExpanderItem;
                        lstiBuddy.AllowDrop = true;
                        lstiBuddy.Tag       = MyBuddies[i].ID.ToString() + "," + MyBuddies[i].DisplayName;

                        lstiBuddy.PreviewMouseDown += new MouseButtonEventHandler(lstiBuddy_PreviewMouseDown);
                        lstBuddies.Items.Add(lstiBuddy);
                    }
                }

                lstBuddies.Items.Remove(((Canvas)((Button)sender).Parent).Parent);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ctlBuddyGrid_btnAcceptClicked()", "Controls\\CtlBuddyList.xaml.cs");
            }
        }
 public void Dispose()
 {
     try
     {
         if (EntItemSelectionChanged != null)
         {
             EntItemSelectionChanged = null;
         }
         if (objExpanderItem != null)
         {
             objExpanderItem = null;
         }
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "Dispose()", "Controls\\BuddyExplorer\\CtlExpanderModuleContent.xaml.cs");
     }
 }
        public void AddItem(string strCaption, bool ShowImage, ImageType objImageType, string strTag)
        {
            try
            {
                objExpanderItem = new CtlExpanderItem();


                objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;

                if (objImageType == ImageType.MaleBuddy || objImageType == ImageType.FemaleBuddy)
                {
                    objExpanderItem.AllowDrop = true;
                    objExpanderItem.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(objExpanderItem_PreviewMouseDown);
                }

                objExpanderItem.Tag = strTag;
                if (ShowImage)
                {
                    if (objImageType == ImageType.Page)
                    {
                        objExpanderItem.Image = @"\Skins\Images\Page.png";
                    }
                    else if (objImageType == ImageType.Module)
                    {
                        objExpanderItem.Image = @"\Skins\Images\Modules.png";
                    }
                    else if (objImageType == ImageType.MaleBuddy)
                    {
                        objExpanderItem.Image = @"\Skins\Images\Buddy.Png";
                    }
                    else if (objImageType == ImageType.FemaleBuddy)
                    {
                        objExpanderItem.Image = @"\Skins\Images\FBuddy.Png";
                    }
                }
                else
                {
                    objExpanderItem.Image = "";
                }

                objExpanderItem.Caption = strCaption;

                if (strTag == "offline")
                {
                   
                    objExpanderItem.Image = @"\Skins\Images\FBuddy.Png";
                    objExpanderItem.ToolTip = strCaption + " is offline";

                    objExpanderItem.PreviewMouseDown -= new System.Windows.Input.MouseButtonEventHandler(objExpanderItem_PreviewMouseDown);
                }
                else if (strTag == "online")
                {
                    
                    objExpanderItem.Image = @"\Skins\Images\Buddy.Png";
                    objExpanderItem.ToolTip = strCaption + " is online";
                }



                TreeViewItem objTrviExpanderItem = new TreeViewItem();
                objTrviExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objTrviExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;
                objTrviExpanderItem.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(objTrviExpanderItem_PreviewMouseLeftButtonDown);
                objTrviExpanderItem.Header = objExpanderItem;


                trvExpanderContent.Items.Add(objTrviExpanderItem);
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "AddItem()", "Controls\\BuddyExplorer\\CtlExpanderModuleContent.xaml.cs");
            }
        }
        public void AddItem(string strCaption)
        {
            try
            {
                objExpanderItem = new CtlExpanderItem();
                objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;

                objExpanderItem.Image = "";
                objExpanderItem.Caption = strCaption;

                TreeViewItem objTrviExpanderItem = new TreeViewItem();
                objTrviExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objTrviExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;
                objTrviExpanderItem.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(objTrviExpanderItem_PreviewMouseLeftButtonDown);
                objTrviExpanderItem.Header = objExpanderItem;

                trvExpanderContent.Items.Add(objTrviExpanderItem);
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "AddItem()", "Controls\\BuddyExplorer\\CtlExpanderModuleContent.xaml.cs");
            }
        }        
Esempio n. 8
0
        void objTrviExpanderItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                CtlExpanderItem ucExpItemTemp = e.Source as CtlExpanderItem;
                Separator       spTemp        = ((CtlExpanderItem)(e.Source)).spWidgets as Separator;
                UniformGrid     ufgTemp       = ((CtlExpanderItem)(e.Source)).ufgWidgets as UniformGrid;

                if (Keyboard.Modifiers == ModifierKeys.Control)
                {
                    if (selectedExItems.ContainsValue(ucExpItemTemp.Caption))
                    {
                        ucExpItemTemp.Background = Brushes.Transparent;
                        selectedExItems.Remove(ucExpItemTemp);
                    }
                    else
                    {
                        ucExpItemTemp.Background = Brushes.DarkBlue;
                        selectedExItems.Add(ucExpItemTemp, ucExpItemTemp.Caption);


                        if (EntWidgetToolBar != null)
                        {
                            EntWidgetToolBar("Show");
                        }
                    }
                    foreach (CtlExpanderItem objExpItem in selectedExItems.Keys)
                    {
                        objExpItem.spWidgets.Visibility  = Visibility.Collapsed;
                        objExpItem.ufgWidgets.Visibility = Visibility.Collapsed;
                        ((Grid)objExpItem.ufgWidgets.Parent).MinHeight = 0.0;
                    }
                }

                else
                {
                    if (EntWidgetToolBar != null)
                    {
                        EntWidgetToolBar("Hide");
                    }
                    if (selectedExItems.Count == 0)
                    {
                        ucExpItemTemp.Background         = Brushes.DarkBlue;
                        spTemp.Visibility                = Visibility.Visible;
                        ufgTemp.Visibility               = Visibility.Visible;
                        ((Grid)ufgTemp.Parent).MinHeight = 80.0;
                        selectedExItems.Add(ucExpItemTemp, ucExpItemTemp.Caption);
                        if (ucExpItemTemp.Tag.ToString() == "offline")
                        {
                            for (int i = 0; i < ufgTemp.Children.Count - 2; i++)
                            {
                                ufgTemp.Children[i].IsEnabled = false;
                                ufgTemp.Children[i].Opacity   = 0.5;
                            }
                        }
                        else
                        {
                            for (int i = 0; i < ufgTemp.Children.Count - 2; i++)
                            {
                                ufgTemp.Children[i].IsEnabled = true;
                                ufgTemp.Children[i].Opacity   = 1;
                            }
                        }
                    }
                    else
                    {
                        if (selectedExItems.Count == 1)
                        {
                            if (selectedExItems.ContainsKey(ucExpItemTemp))
                            {
                                ucExpItemTemp.Background         = Brushes.Transparent;
                                spTemp.Visibility                = Visibility.Collapsed;
                                ufgTemp.Visibility               = Visibility.Collapsed;
                                ((Grid)ufgTemp.Parent).MinHeight = 0.0;
                                selectedExItems.Clear();
                            }
                            else
                            {
                                foreach (CtlExpanderItem objExpItem in selectedExItems.Keys)
                                {
                                    objExpItem.Background            = Brushes.Transparent;
                                    objExpItem.spWidgets.Visibility  = Visibility.Collapsed;
                                    objExpItem.ufgWidgets.Visibility = Visibility.Collapsed;
                                    ((Grid)objExpItem.ufgWidgets.Parent).MinHeight = 0.0;
                                }
                                selectedExItems.Clear();

                                ucExpItemTemp.Background         = Brushes.DarkBlue;
                                spTemp.Visibility                = Visibility.Visible;
                                ufgTemp.Visibility               = Visibility.Visible;
                                ((Grid)ufgTemp.Parent).MinHeight = 80.0;
                                selectedExItems.Add(ucExpItemTemp, ucExpItemTemp.Caption);

                                if (ucExpItemTemp.Tag.ToString() == "offline")
                                {
                                    for (int i = 0; i < ufgTemp.Children.Count - 2; i++)
                                    {
                                        ufgTemp.Children[i].IsEnabled = false;
                                        ufgTemp.Children[i].Opacity   = 0.5;
                                    }
                                }
                                else
                                {
                                    for (int i = 0; i < ufgTemp.Children.Count - 2; i++)
                                    {
                                        ufgTemp.Children[i].IsEnabled = true;
                                        ufgTemp.Children[i].Opacity   = 1;
                                    }
                                }
                            }
                        }

                        else if (selectedExItems.Count > 1)
                        {
                            foreach (CtlExpanderItem objExpItem in selectedExItems.Keys)
                            {
                                objExpItem.Background            = Brushes.Transparent;
                                objExpItem.spWidgets.Visibility  = Visibility.Collapsed;
                                objExpItem.ufgWidgets.Visibility = Visibility.Collapsed;
                                ((Grid)objExpItem.ufgWidgets.Parent).MinHeight = 0.0;
                            }
                            selectedExItems.Clear();

                            ucExpItemTemp.Background         = Brushes.DarkBlue;
                            spTemp.Visibility                = Visibility.Visible;
                            ufgTemp.Visibility               = Visibility.Visible;
                            ((Grid)ufgTemp.Parent).MinHeight = 80.0;
                            selectedExItems.Add(ucExpItemTemp, ucExpItemTemp.Caption);

                            if (ucExpItemTemp.Tag.ToString() == "offline")
                            {
                                for (int i = 0; i < ufgTemp.Children.Count - 2; i++)
                                {
                                    ufgTemp.Children[i].IsEnabled = false;
                                    ufgTemp.Children[i].Opacity   = 0.5;
                                }
                            }
                            else
                            {
                                for (int i = 0; i < ufgTemp.Children.Count - 2; i++)
                                {
                                    ufgTemp.Children[i].IsEnabled = true;
                                    ufgTemp.Children[i].Opacity   = 1;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "objTrviExpanderItem_PreviewMouseLeftButtonDown()", "Controls\\BuddyExplorer\\CtlExpanderContent.xaml.cs");
            }
        }
Esempio n. 9
0
        public void AddItem(string strCaption, bool ShowImage, ImageType objImageType, string strTag)
        {
            try
            {
                objExpanderItem = new CtlExpanderItem();


                objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                objExpanderItem.VerticalAlignment   = VerticalAlignment.Stretch;

                if (objImageType == ImageType.MaleBuddy || objImageType == ImageType.FemaleBuddy)
                {
                    objExpanderItem.AllowDrop = true;
                }

                objExpanderItem.Tag = strTag;


                if (ShowImage)
                {
                    if (objImageType == ImageType.Page)
                    {
                        objExpanderItem.Image = @"\Skins\Images\Page.png";
                    }
                    else if (objImageType == ImageType.Module)
                    {
                        objExpanderItem.Image = @"\Skins\Images1\Skins.png";
                    }
                    else if (objImageType == ImageType.MaleBuddy)
                    {
                        objExpanderItem.Image = @"\Skins\Images\Buddy.Png";
                    }
                    else if (objImageType == ImageType.FemaleBuddy)
                    {
                        objExpanderItem.Image = @"\Skins\Images\FBuddy.Png";
                    }
                }
                else
                {
                    objExpanderItem.Image = "";
                }

                objExpanderItem.Caption = strCaption;

                if (strTag == "offline")
                {
                    objExpanderItem.Image   = @"\Skins\Images\FBuddy.Png";
                    objExpanderItem.ToolTip = strCaption + " is offline";

                    objExpanderItem.PreviewMouseDown -= new System.Windows.Input.MouseButtonEventHandler(objExpanderItem_PreviewMouseDown);
                }
                else if (strTag == "online")
                {
                    objExpanderItem.Image             = @"\Skins\Images\Buddy.Png";
                    objExpanderItem.ToolTip           = strCaption + " is online";
                    objExpanderItem.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(objExpanderItem_PreviewMouseDown);
                }

                objExpanderItem.EntLoadSelectedWid += new CtlExpanderItem.DelLoadSelectedWid(objExpanderItem_EntLoadSelectedWid);

                TreeViewItem objTrviExpanderItem = new TreeViewItem();
                objTrviExpanderItem.HorizontalAlignment         = HorizontalAlignment.Stretch;
                objTrviExpanderItem.VerticalAlignment           = VerticalAlignment.Stretch;
                objTrviExpanderItem.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(objTrviExpanderItem_PreviewMouseLeftButtonDown);
                objTrviExpanderItem.Header = objExpanderItem;


                trvExpanderContent.Items.Add(objTrviExpanderItem);
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "AddItem()", "Controls\\BuddyExplorer\\CtlExpanderContent.xaml.cs");
            }
        }
Esempio n. 10
0
        public void LoadBuddyList()
        {
            try
            {
                //m_DelJoin = new DelJoin(EntsvcJoin);
                //m_DelIamOnline = new DelIamOnline(EntsvcIamOnline);
                //m_DelReply = new DelReply(EntsvcReply);

                objBuddyReqCollection = ClsBuddyReqCollection.GetByUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (objBuddyReqCollection != null)
                {
                    for (int i = 0; i < objBuddyReqCollection.Count; i++)
                    {
                        Canvas cnvBuddy = new Canvas();
                        cnvBuddy.Width  = 150;
                        cnvBuddy.Height = 50;

                        Label lblHeader = new Label();
                        lblHeader.Height = 25;
                        lblHeader.Width  = 150;
                        lblHeader.SetValue(Canvas.TopProperty, 0.0);
                        lblHeader.SetValue(Canvas.LeftProperty, 0.0);
                        lblHeader.Content = objBuddyReqCollection[i].ReqDisplayName + " Wants to Join You!!";

                        cnvBuddy.Children.Add(lblHeader);

                        Label lblQuestion = new Label();
                        lblQuestion.Height  = 25;
                        lblQuestion.Width   = 50;
                        lblQuestion.Content = "Add ?";
                        lblQuestion.SetValue(Canvas.TopProperty, 25.0);
                        lblQuestion.SetValue(Canvas.LeftProperty, 0.0);

                        cnvBuddy.Children.Add(lblQuestion);

                        Button btnAccept = new Button();
                        btnAccept.Content = "Accept";
                        btnAccept.Width   = 50;
                        btnAccept.Tag     = i;
                        btnAccept.SetValue(Canvas.TopProperty, 25.0);
                        btnAccept.SetValue(Canvas.LeftProperty, 50.0);
                        btnAccept.Click += new RoutedEventHandler(ctlBuddyGrid_btnAcceptClicked);
                        cnvBuddy.Children.Add(btnAccept);

                        Button btnReject = new Button();
                        btnReject.Content = "Reject";
                        btnReject.Width   = 50;
                        btnReject.Tag     = i;
                        btnReject.SetValue(Canvas.TopProperty, 25.0);
                        btnReject.SetValue(Canvas.LeftProperty, 100.0);
                        btnReject.Click += new RoutedEventHandler(ctlBuddyGrid_btnRejectClicked);
                        cnvBuddy.Children.Add(btnReject);

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content   = cnvBuddy;
                        lstiBuddy.AllowDrop = false;
                        lstiBuddy.Tag       = -1;

                        lstBuddies.Items.Add(lstiBuddy);
                    }
                }

                ClsBuddyCollection MyBuddies = ClsBuddyCollection.GetByMyUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (MyBuddies != null)
                {
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcJoin += new ClsPeerCommunicationChannel.DelsvcJoin(CtlBuddyList_EntsvcJoin);
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcIamOnline += new ClsPeerCommunicationChannel.DelsvcIamOnline(CtlBuddyList_EntsvcIamOnline);
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcReply += new ClsPeerCommunicationChannel.DelsvcReply(CtlBuddyList_EntsvcReply);
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcStartConference+=new ClsPeerCommunicationChannel.DelsvcStartConference(CtlBuddyList_EntsvcStartConference);
                    //npcPeerCommuServer = new NetPeerService.NetPeerClient();
                    //PeerCommuService = (IPeerCommunication)npcPeerCommuServer.OpenClient<IPeerCommunication>("net.tcp://"+App.CreMachName+":2500/PeerCommunication", VMuktiAPI.VMuktiInfo.CurrentPeer.MeshID, ref objPeerCommuChannel);
                    //PeerCommuService.svcJoin();

                    for (int i = 0; i < MyBuddies.Count; i++)
                    {
                        CtlExpanderItem objExpanderItem = new CtlExpanderItem();
                        objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                        objExpanderItem.VerticalAlignment   = VerticalAlignment.Stretch;
                        objExpanderItem.Image   = @"\Images\Buddy.Png";
                        objExpanderItem.Caption = MyBuddies[i].DisplayName;

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content   = objExpanderItem;
                        lstiBuddy.AllowDrop = true;
                        lstiBuddy.Tag       = MyBuddies[i].ID.ToString() + "," + MyBuddies[i].DisplayName;

                        lstiBuddy.PreviewMouseDown += new MouseButtonEventHandler(lstiBuddy_PreviewMouseDown);
                        lstBuddies.Items.Add(lstiBuddy);
                    }
                }


                //ctlBuddyGrid.Bind(objBuddyReqCollection);

                //ctlBuddyGrid.btnAcceptClicked += new CtlBuddyGrid.ButtonClicked(ctlBuddyGrid_btnAcceptClicked);
                //ctlBuddyGrid.btnRejectClicked += new CtlBuddyGrid.ButtonClicked(ctlBuddyGrid_btnRejectClicked);
                // btnAdd.Click += new RoutedEventHandler(btnAdd_Click);
                //this.PreviewMouseDown += new MouseButtonEventHandler(CtlBuddyList_PreviewMouseDown);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "LoadBuddyList()", "Controls\\CtlBuddyList.xaml.cs");
            }
        }
        //void mnuViewProfile_Click(object sender, RoutedEventArgs e)
        //{
        //    string buddies = ((MenuItem)sender).Tag.ToString();

        //    //buddies = "123,asd,234,zxcvg,3456,sdfgh,4245,wdfgs,";
        //    buddies = buddies.Substring(0,buddies.LastIndexOf(','));
        //    string buddyProfile = null;
        //    if (buddies.Contains(","))
        //    {
        //         buddyProfile = buddies.Substring(buddies.LastIndexOf(',')+1);
        //    }
        //    else
        //    {
        //        buddyProfile = buddies;
        //    }

        //    int userID = VMukti.Business.clsProfile.GetUserID(buddyProfile);

        //    VMuktiAPI.VMuktiHelper.CallEvent("ViewProfile", null, new VMuktiEventArgs(userID));
        //}

        //void trvExpanderContent_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        //{
        //    try
        //    {
        //        if (this.Tag.ToString() == "BuddyType")
        //        {
        //            if (selectedExItems.Count > 0)
        //            {
        //                ContextMenu cntMenuCollMod = new ContextMenu();

        //                ClsModuleCollection cmc = ClsModuleCollection.GetOnlyCollMod();
        //                for (int i = 0; i < cmc.Count; i++)
        //                {
        //                    MenuItem mnuColl = new MenuItem();
        //                    mnuColl.Header = cmc[i].ModuleTitle;
        //                    mnuColl.Tag = cmc[i].ModuleId;
        //                    mnuColl.Click += new RoutedEventHandler(mnuColl_Click);
        //                    cntMenuCollMod.Items.Add(mnuColl);
        //                }

        //                Separator sp = new Separator();
        //                cntMenuCollMod.Items.Add(sp);

        //                string strBuddiesName = "";
        //                string allBuddies = "";
        //                //((TreeViewItem)((TreeView)sender).SelectedValue).Header
        //                foreach (KeyValuePair<CtlExpanderItem, string> strBName in selectedExItems)
        //                {
        //                    if (((CtlExpanderItem)strBName.Key).Tag.ToString().Trim() == "online")
        //                    {
        //                        strBuddiesName += strBName.Value + ",";
        //                    }
        //                    allBuddies += strBName.Value + ",";                               
        //                }
        //                if (strBuddiesName == "")
        //                {
        //                    cntMenuCollMod.Items.Clear();
        //                    for (int i = 0; i < cmc.Count; i++)
        //                    {
        //                        MenuItem mnuColl = new MenuItem();
        //                        mnuColl.Header = cmc[i].ModuleTitle;
        //                        mnuColl.Tag = cmc[i].ModuleId;
        //                        mnuColl.IsEnabled = false;
        //                        mnuColl.Click += new RoutedEventHandler(mnuColl_Click);
        //                        cntMenuCollMod.Items.Add(mnuColl);
        //                    }
        //                }
        //                System.Windows.Controls.MenuItem menuItem1;
        //                menuItem1 = new System.Windows.Controls.MenuItem();
        //                menuItem1.Header = "Remove Buddy";
        //                //menuItem1.Tag = ctlItem.Caption;
        //                menuItem1.Click += new RoutedEventHandler(menuItem1_Click);
        //                cntMenuCollMod.Items.Add(menuItem1);

        //                if (VMuktiAPI.VMuktiInfo.CurrentPeer.RoleID == 1)
        //                {
        //                    MenuItem mnuViewLog = new MenuItem();
        //                    mnuViewLog.Header = "View Log";
        //                    mnuViewLog.Click += new RoutedEventHandler(mnuViewLog_Click);
        //                    mnuViewLog.Tag = strBuddiesName;
        //                    cntMenuCollMod.Items.Add(mnuViewLog);
        //                }
        //                MenuItem mnuViewProfile = new MenuItem();
        //                mnuViewProfile.Header = "View Profile";
        //                mnuViewProfile.Click += new RoutedEventHandler(mnuViewProfile_Click);
        //                mnuViewProfile.Tag = allBuddies;
        //                cntMenuCollMod.Items.Add(mnuViewProfile);

        //                trvExpanderContent.ContextMenu = cntMenuCollMod;
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        VMuktiHelper.ExceptionHandler(ex, "trvExpanderContent_PreviewMouseRightButtonDown()", "Controls\\BuddyExplorer\\CtlExpanderContent.xaml.cs");
        //    }
        //}
        #endregion 

        #region BuddySingleClick + Widgets

        void objExpanderItem_EntLoadSelectedWid(CtlExpanderItem buddyname, int modid)
        {
            Dictionary<CtlExpanderItem, string> dicttemp = new Dictionary<CtlExpanderItem, string>();
            dicttemp.Add(buddyname, buddyname.Caption);
            if (modid == 999)
            {               
                selectedExItems.Add(buddyname, buddyname.Caption);
                this.menuItem1_Click(null, null);
            }           
            else
            {
            if (EntCModBuddies != null)
            {
                EntCModBuddies(dicttemp, modid);
                }
            }
        }
        void ctlBuddyGrid_btnAcceptClicked(object sender, RoutedEventArgs e)
        {
            try
            {
                ClsBuddy objBuddy = new ClsBuddy();
                objBuddy.ID = -1;
                objBuddy.UserID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                objBuddy.MyUserID = objBuddyReqCollection[int.Parse(((Button)sender).Tag.ToString())].ReqUserID;
                objBuddy.Save();

                objBuddyReqCollection[int.Parse(((Button)sender).Tag.ToString())].Delete();

                ClsBuddyCollection MyBuddies = ClsBuddyCollection.GetByMyUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (MyBuddies != null)
                {
                    lstBuddies.Items.Clear();
                    for (int i = 0; i < MyBuddies.Count; i++)
                    {
                        CtlExpanderItem objExpanderItem = new CtlExpanderItem();
                        objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                        objExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;
                        objExpanderItem.Image = @"\Images\Buddy.Png";
                        objExpanderItem.Caption = MyBuddies[i].DisplayName;

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content = objExpanderItem;
                        lstiBuddy.AllowDrop = true;
                        lstiBuddy.Tag = MyBuddies[i].ID.ToString() + "," + MyBuddies[i].DisplayName;

                        lstiBuddy.PreviewMouseDown += new MouseButtonEventHandler(lstiBuddy_PreviewMouseDown);
                        lstBuddies.Items.Add(lstiBuddy);
                    }
                }

                lstBuddies.Items.Remove(((Canvas)((Button)sender).Parent).Parent);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ctlBuddyGrid_btnAcceptClicked()", "Controls\\CtlBuddyList.xaml.cs");
            }
        }
        public void LoadBuddyList()
        {
            try
            {
                //m_DelJoin = new DelJoin(EntsvcJoin);
                //m_DelIamOnline = new DelIamOnline(EntsvcIamOnline);
                //m_DelReply = new DelReply(EntsvcReply);

                objBuddyReqCollection = ClsBuddyReqCollection.GetByUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (objBuddyReqCollection != null)
                {
                    for (int i = 0; i < objBuddyReqCollection.Count; i++)
                    {
                        Canvas cnvBuddy = new Canvas();
                        cnvBuddy.Width = 150;
                        cnvBuddy.Height = 50;

                        Label lblHeader = new Label();
                        lblHeader.Height = 25;
                        lblHeader.Width = 150;
                        lblHeader.SetValue(Canvas.TopProperty, 0.0);
                        lblHeader.SetValue(Canvas.LeftProperty, 0.0);
                        lblHeader.Content = objBuddyReqCollection[i].ReqDisplayName + " Wants to Join You!!";

                        cnvBuddy.Children.Add(lblHeader);

                        Label lblQuestion = new Label();
                        lblQuestion.Height = 25;
                        lblQuestion.Width = 50;
                        lblQuestion.Content = "Add ?";
                        lblQuestion.SetValue(Canvas.TopProperty, 25.0);
                        lblQuestion.SetValue(Canvas.LeftProperty, 0.0);

                        cnvBuddy.Children.Add(lblQuestion);

                        Button btnAccept = new Button();
                        btnAccept.Content = "Accept";
                        btnAccept.Width = 50;
                        btnAccept.Tag = i;
                        btnAccept.SetValue(Canvas.TopProperty, 25.0);
                        btnAccept.SetValue(Canvas.LeftProperty, 50.0);
                        btnAccept.Click += new RoutedEventHandler(ctlBuddyGrid_btnAcceptClicked);
                        cnvBuddy.Children.Add(btnAccept);

                        Button btnReject = new Button();
                        btnReject.Content = "Reject";
                        btnReject.Width = 50;
                        btnReject.Tag = i;
                        btnReject.SetValue(Canvas.TopProperty, 25.0);
                        btnReject.SetValue(Canvas.LeftProperty, 100.0);
                        btnReject.Click += new RoutedEventHandler(ctlBuddyGrid_btnRejectClicked);
                        cnvBuddy.Children.Add(btnReject);

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content = cnvBuddy;
                        lstiBuddy.AllowDrop = false;
                        lstiBuddy.Tag = -1;

                        lstBuddies.Items.Add(lstiBuddy);
                    }
                }

                ClsBuddyCollection MyBuddies = ClsBuddyCollection.GetByMyUserID(VMuktiAPI.VMuktiInfo.CurrentPeer.ID);
                if (MyBuddies != null)
                {
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcJoin += new ClsPeerCommunicationChannel.DelsvcJoin(CtlBuddyList_EntsvcJoin);
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcIamOnline += new ClsPeerCommunicationChannel.DelsvcIamOnline(CtlBuddyList_EntsvcIamOnline);
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcReply += new ClsPeerCommunicationChannel.DelsvcReply(CtlBuddyList_EntsvcReply);
                    //((ClsPeerCommunicationChannel)objPeerCommuChannel).EntsvcStartConference+=new ClsPeerCommunicationChannel.DelsvcStartConference(CtlBuddyList_EntsvcStartConference);
                    //npcPeerCommuServer = new NetPeerService.NetPeerClient();
                    //PeerCommuService = (IPeerCommunication)npcPeerCommuServer.OpenClient<IPeerCommunication>("net.tcp://"+App.CreMachName+":2500/PeerCommunication", VMuktiAPI.VMuktiInfo.CurrentPeer.MeshID, ref objPeerCommuChannel);
                    //PeerCommuService.svcJoin();

                    for (int i = 0; i < MyBuddies.Count; i++)
                    {
                        CtlExpanderItem objExpanderItem = new CtlExpanderItem();
                        objExpanderItem.HorizontalAlignment = HorizontalAlignment.Stretch;
                        objExpanderItem.VerticalAlignment = VerticalAlignment.Stretch;
                        objExpanderItem.Image = @"\Images\Buddy.Png";
                        objExpanderItem.Caption = MyBuddies[i].DisplayName;

                        ListBoxItem lstiBuddy = new ListBoxItem();
                        lstiBuddy.Content = objExpanderItem;
                        lstiBuddy.AllowDrop = true;
                        lstiBuddy.Tag = MyBuddies[i].ID.ToString() + "," + MyBuddies[i].DisplayName;

                        lstiBuddy.PreviewMouseDown += new MouseButtonEventHandler(lstiBuddy_PreviewMouseDown);
                        lstBuddies.Items.Add(lstiBuddy);

                    }
                }


                //ctlBuddyGrid.Bind(objBuddyReqCollection);

                //ctlBuddyGrid.btnAcceptClicked += new CtlBuddyGrid.ButtonClicked(ctlBuddyGrid_btnAcceptClicked);
                //ctlBuddyGrid.btnRejectClicked += new CtlBuddyGrid.ButtonClicked(ctlBuddyGrid_btnRejectClicked);
                // btnAdd.Click += new RoutedEventHandler(btnAdd_Click);
                //this.PreviewMouseDown += new MouseButtonEventHandler(CtlBuddyList_PreviewMouseDown);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "LoadBuddyList()", "Controls\\CtlBuddyList.xaml.cs");
            }
        }