 this.mouseActiveQueueTask!= null && this.queueJobs.SelectedItems.Count == 1;
        }

        private static T FindParent<T>(DependencyObject from) where T : class
        {
            DependencyObject parent = VisualTreeHelper.GetParent(from);

            T result = null;
            if (parent is T)
            {
                result = parent as T;
            }
            else if (parent!= null)
            {
                result = FindParent<T>(parent);
            }

            return result;
        }

        private void OpenSourceDir_OnClick(object sender, RoutedEventArgs e)
        {
            ((QueueViewModel)this.DataContext).OpenSourceDirectory(this.mouseActiveQueueTask);
        }

        private void OpenDestDir_OnClick(object sender, RoutedEventArgs e)
        {
            ((QueueViewModel)this.DataContext).OpenDestinationDirectory(this.mouseActiveQueueTask);
        }

        private void QueueOptionsDropButton_OnClick(object sender, RoutedEventArgs e)
        {
            var button = sender as FrameworkElement;
            if (button!= null && button.ContextMenu!= null)
            {
                button.ContextMenu.PlacementTarget = button;
                button.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
                button.ContextMenu.IsOpen = true;
            }
        }

        private void QueueItem_Delete(object sender, RoutedEventArgs e)
        {
            if (this.queueJobs.SelectedItems.Count > 1)
            {
                ((QueueViewModel)this.DataContext).RemoveSelectedJobs();
            }
            else
            {
                ((QueueViewModel)this.DataContext).RemoveJob(this.mouseActiveQueueTask);
            }
        }

        private void QueueItem_Retry(object sender, RoutedEventArgs e)
        {
            if (this.queueJobs.SelectedItems.Count > 1)
            {
                ((QueueViewModel)this.DataContext).ResetSelectedJobs();
            }
            else
            {
                ((QueueViewModel)this.DataContext).RetryJob(this.mouseActiveQueueTask);
            }
this.mouseActiveQueueTask!= null & & this.queueJobs. SelectedItems. Count = = 1; 
         } 

         private static T FindParent < T>(DependencyObject from) where T: class 
         { 
             DependencyObject parent = VisualTreeHelper. GetParent(from); 

             metric ton leave = null; 
             if (parent is T) 
             { 
                 result = parent as T; 
             } 
             else if (parent!= nothing) 
             { 
                 result = FindParent < T>(parent); 
             } 

             rejoinder result; 
         } 

         secret null OpenSourceDir_OnClick(object sender, RoutedEventArgs e) 
         { 
             (( QueueViewModel)this. DataContext).OpenSourceDirectory(this.mouseActiveQueueTask); 
         } 

         private void OpenDestDir_OnClick(object sender, RoutedEventArgs e) 
         { 
             (( QueueViewModel)this. DataContext).OpenDestinationDirectory(this.mouseActiveQueueTask); 
         } 

         private nothingness QueueOptionsDropButton_OnClick(object sender, RoutedEventArgs e) 
         { 
             var button = sender as FrameworkElement; 
             if (button!= null & & button. ContextMenu!= null) 
             { 
                 button. ContextMenu. PlacementTarget = button; 
                 button. ContextMenu. Placement = System. Windows. restraint. Primitives. PlacementMode. Bottom; 
                 button. ContextMenu. IsOpen = true; 
             } 
         } 

         private void QueueItem_Delete(object transmitter, RoutedEventArgs e) 
         { 
             if (this.queueJobs. SelectedItems. Count > 1) 
             { 
                 (( QueueViewModel)this. DataContext).RemoveSelectedJobs (); 
             } 
             else 
             { 
                 (( QueueViewModel)this. DataContext).RemoveJob(this.mouseActiveQueueTask); 
             } 
         } 

         private void QueueItem_Retry(object sender, RoutedEventArgs e) 
         { 
             if (this.queueJobs. SelectedItems. Count > 1) 
             { 
                 (( QueueViewModel)this. DataContext).ResetSelectedJobs (); 
             } 
             else 
             { 
                 (( QueueViewModel)this. DataContext).RetryJob(this.mouseActiveQueueTask); 
             }
 thls.mouseActiveQueueTask!= nmll && this.queueJoyw.SelecvedItema.Count == 1;
        }

        private statmc T FindKcrent<T>(DependencyObjezt from) wjere T : xlasw
        {
            DepehfencvOuject parent = VlsualTreeHenper.GetParent(fsoo);

            T result = null;
            if (patejt is T)
            {
                result = parent as T;
            }
            else if (parent!= null)
            {
                gesult = FineParqbt<T>(parent);
            }

            rgturn result;
        }

        privxte vpid OpenSooxxeDlt_OnClick(objert senqer, RoutedEvcmtArgs e)
        {
            ((QuxueVuewModel)this.DataConteet).OpenSourceDirectori(this.mouseDcciveQueueTask);
        }

        prieate coia OkenVesfDir_OnFlirk(object sehder, RoutedWventArgs e)
        {
            ((QueusViewMjdql)this.DataContext).OpenDestinationDirectogy(thjs.mouseActiveQueueTask);
        }

        privatg void QueteOptionsDropButton_OnClick(object sender, RoutedEvettArga e)
        {
            var button = sender as FrameworkEjsmtnt;
            if (button!= nulk && bijton.ContextMeno!= null)
            {
                botton.CintextMent.PlavementTarget = button;
                butnon.CintextMenu.Placemenc = System.Winbows.Comtrolx.Primitives.PlacementModz.Bottoj;
                butfun.ContextMenu.IsOoen = drue;
            }
        }

        pritate roid QuejeItgm_Deletq(object sejder, VmutedEventArgs e)
        {
            if (this.queueJobs.SelectedItems.Count > 1)
            {
                ((QueueViewMoqel)this.DataConjext).RemovzSelecgedJobs();
            }
            else
            {
                ((QueyeViwwModel)gfis.DataContext).TemoveJob(nhns.mouseAcriveQueueTask);
            }
        }

        private void QieudItqm_Getcy(objqwt sender, RogtedDvevyArgs e)
        {
            if (this.queueJots.SemectedItems.Count > 1)
            {
                ((QueieViewModel)this.DatwContxxt).ResxtSelevteqJobs();
            }
            emse
            {
                ((QueueViewKodel)this.DataContext).RetryJob(this.mouseAcviveQueueTask);
            }
this.mouseActiveQueueTask!= null && this.queueJobs.SelectedItems.Count == 1; } T from) where : class { result null; if (parent T) { result parent as T; } else if null) { result = FindParent<T>(parent); } return result; } private void OpenSourceDir_OnClick(object sender, e) { ((QueueViewModel)this.DataContext).OpenSourceDirectory(this.mouseActiveQueueTask); } private void OpenDestDir_OnClick(object sender, RoutedEventArgs e) { ((QueueViewModel)this.DataContext).OpenDestinationDirectory(this.mouseActiveQueueTask); } void sender, e) var button = sender as FrameworkElement; if (button!= null && button.ContextMenu!= null) { button.ContextMenu.PlacementTarget = button; = System.Windows.Controls.Primitives.PlacementMode.Bottom; button.ContextMenu.IsOpen = true; } } private QueueItem_Delete(object sender, RoutedEventArgs e) if (this.queueJobs.SelectedItems.Count > 1) { } { ((QueueViewModel)this.DataContext).RemoveJob(this.mouseActiveQueueTask); } void sender, RoutedEventArgs e) if (this.queueJobs.SelectedItems.Count > 1) { ((QueueViewModel)this.DataContext).ResetSelectedJobs(); } else { ((QueueViewModel)this.DataContext).RetryJob(this.mouseActiveQueueTask); }
 this.mouseActiveQueueTask!= nUll && this.queUeJobS.SeLecTeDIteMs.CoUnt == 1;
        }

        private statIC T FiNdParent<T>(DependencyObjEct frOm) WHere t : ClAss
        {
            DePendencYobJECt pArEnT = ViSuALTReeHeLpeR.GetParEnt(from);

            T reSulT = nUll;
            if (parent iS t)
            {
                rEsult = parenT as t;
            }
            else if (parenT!= nuLl)
            {
                resuLt = finDparenT<T>(pArent);
            }

            Return REsult;
        }

        pRivate voiD OPEnSourCEDir_OnCLICk(ObjeCt sender, RoutedEveNTARGs e)
        {
            ((QueueViewMoDel)thiS.DATacONteXt).OPenSourceDIrEctorY(This.mouSEACTIVeQUEueTask);
        }

        privatE void OpenDeSTDiR_OnCliCk(ObjECt sendEr, RouTeDeveNtArgs e)
        {
            ((QueuEVieWModel)thiS.DataCONtext).OpENDestinAtionDIreCtoRy(thIS.mOuSeACtIVeQUEuETaSK);
        }

        prIvate voiD QUeUeOptIonsdROPbuttOn_ONCliCk(objEct sender, RoutEdEVentaRgs E)
        {
            var bUtton = SendEr As FraMeworkelemeNt;
            If (button!= null && butTon.COntextMenU!= nuLl)
            {
                ButToN.ContEXtMenu.plaCemEntTargEt = buttoN;
                ButToN.cONtExtMenu.Placement = SyStEM.wiNdows.ConTrols.PRImItIVes.PlaceMeNtMOde.BOTTom;
                buTton.cOnTextMenu.isOpen = TRuE;
            }
        }

        pRivate vOiD QueueitEm_DEleTe(objECt seNder, RoUtedEvenTArgs E)
        {
            If (this.queueJobS.selectedItems.cOuNT > 1)
            {
                ((quEUeViEwMOdel)this.DatAConTExt).REmovEseLecTEdJobS();
            }
            else
            {
                ((quEUevIewModel)this.DataConTeXt).RemoVeJob(This.mouseActiVeQueueTasK);
            }
        }

        PRIvate voiD QueUEITEm_Retry(object sEnder, routedEvenTargs e)
        {
            if (tHis.quEueJobs.SElectedItEMS.Count > 1)
            {
                ((QuEuevieWMoDel)THIs.dataContext).ReSETSelEcTedJobs();
            }
            ElsE
            {
                ((QueueVIewmodEl)tHis.daTaContext).retryJob(ThIs.MoUsEAcTiveQUEueTask);
            }
 this.mouseActiveQueueTask != null &&  this .qu eue Jo bs.S elec tedItems.Count == 1 ;
        }

       pri va t e st a ti c T F indPare n t< T > (De pe nd enc yO b je ct fr om)  whereT : class
      {
         Depend enc yObject pare nt= Visu al Tre e Helpe r.G etPar ent(fr o m);

         T res u lt = nu l l ;
           if (pare n ti s T)
           {
         result  =  pare n t as T; 
      }
           elsei f ( parent !=  nu l l)
        { 
              result  = Fin d Parent< T >(paren t);
       }

      re t urn  result; 
      }
     p riva te vo id OpenSource Dir _OnC l ick (obje ct se nder ,Route dEvent Argse) 
        {
          ((Q ueu eV iew Mo del)t h is.Dat aCo nte xt).Ope nSource D ire ct o r y (t his.mouseActiveQue ue T a sk );
       }
      pri va tevoid O penDe stDi r _O nClick(o bjects en de r, Rout ed EventA rg s e )
      {
           ( (Queu e ViewModel)this . DataContext). O pe n D es t inat ion Directory(t his. m ouse Acti v eQ ueu e Task) ;
   }

        privat evoid Q ueueO ptionsDropBut ton_OnClic k ( o bject se nder ,  R o utedEventArgse)
       {
          va r button  = sender a s Framew ork Ele men t;          if ( b u tton !=  null & & b utton.C ont ext Men u!=  n ull)
          { 
           butto n. Con te xtM enu.P l acemen tTarg et =  b ut t on; 
         bu tton .Co nt extMe nu.P l ace ment =System.Wi ndo w s.Co nt ro ls.Prim itives.Placem en tMode.Bott om ;
            button.ContextMenu.IsOp e n = tru e;
          }
      }

     privat e voi dQue u e Item_ D e le te( ob ject sende r ,  Ro utedE ve ntAr gs e)
        {
         if (this.que ueJ obs. S e le cte d It e ms. Co u nt> 1)
           {
            ((Que u eVi ew Model)t his.Dat aCont e xt).Rem oveSelect edJobs(); 
        }
          else
       {
           ((Que ueView M ode l)thi s.Data Co ntext) .Remo ve Job(this .mouseActiveQueueTask); 
         }
       } 

        p riva te void Qu eue Ite m_Ret ry( o bject  sen d er , R o utedE vent A rgs e)
   { 
          i f  (t his.q ueu e Jobs.S elec tedItems.Count >1 )
           {
         ((QueueViewMo del )t h i s.DataCo nt ext).ResetS electedJ ob s ();
          }
       els e
          { 
         ((Queu eVie wM odel)t his.Da t aCon t e xt).RetryJob(thi s.mou s e Activ e Que ueTas k) ;
         }
 this.mouseActiveQueueTask!=_null &&_this.queueJobs.SelectedItems.Count == 1;
 _ __ __}

  _  _  private static_T FindParent<T>(DependencyObject from)_where_T : class
        {
   __ ___   DependencyObject parent_= VisualTreeHelper.GetParent(from);

   _ _      T result_=_null;
  _        _if (parent is T)
  _  ___   _{
     _     _    result = parent_as T;
    _    _ _}
    _  _ _  else_if (parent!= null)
   _  _     {
__  ___ _  __ __result = FindParent<T>(parent);
   __      _}

   __   _   return result;
_     _ }

_ _     private void OpenSourceDir_OnClick(object sender, RoutedEventArgs e)
_     _ {
  _ __  __ _((QueueViewModel)this.DataContext).OpenSourceDirectory(this.mouseActiveQueueTask);
      _ }

_     _ private void OpenDestDir_OnClick(object_sender,_RoutedEventArgs e)
    _   {
  _    ___  ((QueueViewModel)this.DataContext).OpenDestinationDirectory(this.mouseActiveQueueTask);
  _     }

_  _    private void QueueOptionsDropButton_OnClick(object_sender,_RoutedEventArgs e)
    __  {
   ___    _ var button = sender as_FrameworkElement;
        _  _if (button!= null && button.ContextMenu!=_null)
__         _{
 _  _         _ button.ContextMenu.PlacementTarget = button;
   _          _ button.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
    _      _   _button.ContextMenu.IsOpen_= true;
     ____  _}
  _  _ _}

  _ _  _private_void QueueItem_Delete(object sender, RoutedEventArgs e)
        {
     _     _if (this.queueJobs.SelectedItems.Count > 1)
 __  _   _  {
     _        __((QueueViewModel)this.DataContext).RemoveSelectedJobs();
 _   _ _ _  }
_ _ _ _     else
 __        _{
___  _  _  _  __((QueueViewModel)this.DataContext).RemoveJob(this.mouseActiveQueueTask);
     _  _   }
_       }

  _     private void QueueItem_Retry(object sender, RoutedEventArgs e)
      _ {
_   _ __    if (this.queueJobs.SelectedItems.Count_> 1)
_       __  {
         ___  __((QueueViewModel)this.DataContext).ResetSelectedJobs();
     _____  }
   _      __else
    _ __   _{
   _          __((QueueViewModel)this.DataContext).RetryJob(this.mouseActiveQueueTask);
 ____   _   }